Regex Tester
Write a regular expression and test it against any string with live match highlighting. See all matches, capture groups and group names at a glance. Uses JavaScript's native RegExp engine. Runs entirely in your browser.
/
/
0Matches
0Groups
Highlighted matches
Regex Quick Reference
| Pattern | Matches |
|---|---|
. | Any character except newline |
\d | Digit (0–9) |
\w | Word character (a–z, A–Z, 0–9, _) |
\s | Whitespace (space, tab, newline) |
^ | Start of string / line |
$ | End of string / line |
* | 0 or more of the previous |
+ | 1 or more of the previous |
? | 0 or 1 of the previous (optional) |
{n,m} | Between n and m repetitions |
(abc) | Capture group |
a|b | a or b |
[abc] | Character class (a, b or c) |
[^abc] | Not a, b or c |
Common Regex Patterns
| Use case | Pattern |
|---|---|
| Email address | [a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,} |
| URL | https?://[^\s]+ |
| IPv4 address | \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b |
| Date YYYY-MM-DD | \d{4}-\d{2}-\d{2} |
| Hex color | #[0-9a-fA-F]{3,6} |
Frequently Asked Questions
What flavor of regex does this tester use?
JavaScript's built-in RegExp engine, which supports character classes, quantifiers, groups, lookaheads and backreferences.
What do the regex flags mean?
g = find all matches; i = case-insensitive; m = multiline (^ and $ match line boundaries); s = dotAll (dot matches newlines).
How do I match a literal dot or bracket?
Escape with a backslash: \. for a literal dot and \[ for a literal bracket.
What is a capture group?
A part of the pattern in parentheses, e.g. (\d+). The matched substring is captured and can be referenced in replacements as $1, $2, etc.