How to use the Regex Tester
- 1
Type a regular expression between the slashes and toggle flags such as g, i, m, s, u and y with the chips beside it.
- 2
Paste the text to search into the Test text pane, or press Sample to load a log excerpt with named groups.
- 3
Matches are highlighted as you type. The Matches list shows each match with its position and every capture group, numbered or named.
- 4
Open Replace and type a replacement using $1, $<name>, $& and friends to see the replaced text live, then copy it.
- 5
Use Copy matches (Ctrl+Shift+C) to copy every match, one per line, and open the Cheat sheet when you need a reminder of the syntax.
Features
- Live highlighting of every match in the test text, with alternating colours for adjacent matches
- Capture groups listed per match, including named groups and the exact character ranges
- Live replace with $1, $<name>, $&, $` and $' exactly as JavaScript's String.replace does
- Flag toggles for global, ignore case, multiline, dotAll, Unicode and sticky
- Runs in a Web Worker and stops a runaway pattern after 1.5 seconds instead of freezing the page
- Clear error messages straight from the JavaScript engine for invalid patterns
- Built-in cheat sheet of the most used tokens
- Remembers your last pattern and text on this device; nothing is uploaded
Why test regular expressions
Regular expressions are compact and unforgiving. A missing escape, a greedy quantifier where a lazy one was meant, or a forgotten flag silently changes what matches, and the only way to be sure is to run the pattern against real text. This tester shows the result as you type: every match highlighted in place, every capture group listed with its value and position, and the outcome of a replacement before you put it in code.
How matching works here
The tester uses your browser’s own JavaScript engine, so behaviour is identical to what your code will do. Without the g flag only the first match is reported; with it the engine walks the whole text, and the tester caps the list at 2,000 matches so a pattern that matches every character does not flood the page. Group ranges come from the engine’s match indices, which is why named and numbered groups show exact start and end offsets.
Matching runs in a Web Worker. If a pattern backtracks catastrophically, the worker is terminated after 1.5 seconds and a fresh one is started, so you can fix the pattern without reloading the page.
Related tasks
To compare the text before and after a replacement, paste both into the Text Diff Checker. To tidy code that contains your pattern, use the Code Formatter.
Frequently asked questions
Which regex flavour does this tester use?
What do the flags do?
How do I use capture groups in the replacement?
Why does the tester say my pattern took too long?
Why are zero-length matches not highlighted?
Is my text uploaded anywhere?
Last updated .