Regex Tester
Test JavaScript regular expressions live, with highlighted matches and capture groups.
Runs in your browser. Your text and files never leave your device.
Quick regex reference
\d \w \s | digit, word character, whitespace |
. | any character except a line break |
* + ? {2,4} | 0 or more, 1 or more, optional, 2 to 4 times |
^ $ | start and end of text (or line with m) |
[abc] [^abc] | one of a, b, c; anything except a, b, c |
(…) (?<name>…) | capture group, named group |
a|b | a or b |
(?=…) (?!…) | followed by, not followed by |
Frequently Asked Questions
Which regex flavour does this use?
JavaScript (ECMAScript) regular expressions, run by your browser. Most syntax is shared with Python, PHP (PCRE) and Java, but lookbehind support and some escapes differ.
What do the flags mean?
g finds all matches instead of the first, i ignores case, m makes ^ and $ match at every line, s lets . match line breaks, and u enables full Unicode, including \p{L} for any letter.
How do I see capture groups?
Each match in the list shows its groups: numbered groups like $1 and named groups like (?<year>\d{4}).
Why does my pattern freeze the page?
Some patterns, like (a+)+$, take exponential time on certain text (catastrophic backtracking). Simplify nested repeats. The tester stops after 1,000 matches to stay responsive.