About this tool
Type a pattern and see every match highlighted in your sample text as you edit, with a table of positions, numbered groups and named groups. Switch to the Replace tab to preview a substitution using $1 or $<name> references before you put it in code. Patterns run with your browser's own JavaScript regex engine in a background worker, so a runaway pattern is stopped instead of freezing the page, and nothing is uploaded.
How to use Regex Tester
- Enter a pattern between the slashes, or paste a full /pattern/flags literal.
- Tick the flags you need, such as g for all matches or i to ignore case.
- Paste the text you want to test.
- Check the highlighted matches and the group table.
- Open Replace to try a replacement string.
Frequently asked questions
Which regex flavor does this use?
JavaScript (ECMAScript), as used in browsers and Node.js. Most syntax is shared with PCRE, Python and Java, but features such as possessive quantifiers or recursion are not supported.
Why do I only see one match?
Without the g flag a JavaScript regex stops after the first match. Turn on g to find all of them.
What happens with a very slow pattern?
Matching runs in a separate worker with a time limit. If a pattern backtracks catastrophically, it is stopped after about two seconds and you get a warning.