Free Online Regex Tester
Write a regular expression and test it against any string in real time. Matches are highlighted instantly. View capture groups, named groups, and match positions. Supports all JavaScript regex flags.
Regex Flags Reference
| Flag | Name | Description |
|---|---|---|
g | Global | Find all matches, not just the first |
i | Case insensitive | Match regardless of upper/lower case |
m | Multiline | ^ and $ match start/end of each line |
s | Dot all | . matches newline characters too |
u | Unicode | Enables full Unicode matching (e.g. emoji, astral symbols) |
Common Regex Patterns
| Pattern | Matches |
|---|---|
^[\w.-]+@[\w.-]+\.\w{2,}$ | Email address |
https?:\/\/[^\s]+ | URL (http or https) |
^\d{4}-\d{2}-\d{2}$ | Date in YYYY-MM-DD format |
#[0-9a-fA-F]{3,6} | Hex color code |
\b\d{1,3}(\.\d{1,3}){3}\b | IPv4 address |
^[+]?[\d\s()-]{7,15}$ | Phone number |
[A-Z][a-z]+ | Capitalized word |
Capture Groups Quick Reference
(...)— Capturing group. Accessible as$1,$2, etc.(?:...)— Non-capturing group. Groups without creating a backreference.(?<name>...)— Named capturing group. Accessible by name.(?=...)— Positive lookahead. Matches position followed by pattern.(?!...)— Negative lookahead. Matches position NOT followed by pattern.(?<=...)— Positive lookbehind. Matches position preceded by pattern.
Frequently Asked Questions
What regex flavor does this tool use?
This tool uses the native JavaScript RegExp engine built into your browser. It is ECMAScript-compliant and supports all modern features including named capture groups, lookahead/lookbehind, and Unicode property escapes (\p{...} with the u flag).
Why is the g flag on by default?
The global flag (g) makes the regex find all matches in the input instead of stopping at the first one. This is the most useful behavior for a tester. You can toggle it off if you only want the first match.
What do the match indices [start…end) mean?
Each match shows its position in the input string as a half-open interval [start, end) — where start is the index of the first character of the match, and end is one past the last character. This follows the same convention as JavaScript's slice(start, end).