Regex Tester (JavaScript)
Write a regular expression and see every match highlighted live, with capture groups. Uses the JavaScript regex engine.
Runs in your browser. Nothing you type is uploaded.
Matches highlighted
Regex cheat sheet
| Pattern | Matches |
|---|---|
\d | Any digit 0–9 |
\w | Letter, digit or underscore |
\s | Space, tab or new line |
. | Any character except a new line |
^ / $ | Start / end of the text (or line with m) |
a* / a+ / a? | 0 or more / 1 or more / 0 or 1 |
a{2,4} | Between 2 and 4 times |
[abc] / [^abc] | One of a, b, c / anything except them |
(…) / (?<name>…) | Capture group / named group |
a|b | a or b |
\b | Word boundary |
Frequently asked questions
Which regex flavour does this use?
JavaScript (ECMAScript) regular expressions — the same engine as Node.js and every browser. Most patterns also work in Python, Java and PHP, but lookbehind and named-group syntax can differ.
Why did my pattern time out?
Some patterns, like (a+)+$, take exponential time on certain inputs ("catastrophic backtracking"). The tester runs your pattern in a background worker and stops it after one second, so the page never freezes. Make nested repeats more specific to fix it.
What do the flags mean?
g finds all matches, i ignores case, m makes ^ and $ match at every line, s lets . match new lines, and u turns on full Unicode support.