RegEx Tester
Test and debug your regular expressions in real-time. Visualize matches, capture groups, and explore common patterns. Regex engine: JavaScript (ECMAScript)
/
/
What is a Regular Expression?
A regular expression (regex or regexp) is a sequence of characters that forms a search pattern. When you search for data in a text, you can use this search pattern to describe what you are looking for.
Common Regex Flags
- g (Global): Don't return after first match, find all occurrences.
- i (Ignore Case): Case-insensitive matching (A matches a).
- m (Multiline): ^ and $ match start and end of a line instead of the whole string.
- s (Dotall): Allows . to match newline characters.
- u (Unicode): Correctly handles unicode surrogate pairs.
Common Regex Examples
| Pattern | Description |
|---|---|
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$ |
Email address validation |
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/ |
URL validation |
^\d{4}-\d{2}-\d{2}$ |
Date format (YYYY-MM-DD) |
^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$ |
Hex Color codes |