Regex Tester
Write a JavaScript regular expression, set the flags and paste some text. Matches are highlighted as you type, with a table of capture groups and a preview of the replacement.
Runs in your browser — nothing is uploaded.
Without the surrounding slashes.
Matches in the text
Matches and groups
Only the first 1000 matches are listed.
| # | Match | Groups |
|---|---|---|
|
|
Replace
Leave empty to skip. $1 group, $<name> named group, $& whole match, $$ a dollar sign.
How to use it
- Type the pattern without the slashes and tick the flags you need (g finds all matches).
- Paste the text to test. Matches are highlighted and listed with their capture groups.
- Fill the replacement box to preview the result. Use $1, $<name> or $& in it.
Frequently asked questions
Which regex flavour is this?
The one your browser’s JavaScript engine uses (ECMAScript). Lookbehind, named groups and Unicode property escapes work in current browsers. PCRE, Python or .NET features such as possessive quantifiers or inline modifiers are not available.
What do the flags mean?
g global, i ignore case, m ^ and $ match at each line, s the dot matches newlines, u Unicode mode, v extended Unicode sets (cannot be combined with u), y sticky, d also record the start and end of each group.
Why does it say the test timed out?
Some patterns, like (a+)+$ on a long string of a’s that ends in another letter, take exponentially longer with every character (catastrophic backtracking). The match runs in a separate worker that is stopped after 2 seconds, so the page stays usable. Rewrite the pattern to avoid nested quantifiers.
Is my text uploaded?
No. The pattern and text never leave your browser.
Why are only 1000 matches listed?
To keep the page fast. The total is still counted, and the highlight and replace preview use the same limit.