Regex tester
Type a pattern and flags, paste some test text, and every match lights up as you type. The table lists each match with its groups, and the replace box previews the result.
- Matches, groups, replace
- Free, no sign-up
Runs in your browser. Nothing you type or open is uploaded. Free to use, no account. More developer tools
How to use it
- Type the pattern and the flags, or pick an example.
- Paste or type the text to test.
- Read the highlighted matches and groups, and try a replacement with $1 or $<name>.
Flags and replacements
The tester uses the JavaScript regular expression engine in your browser. g finds every match, i ignores case, m makes ^ and $ match at line breaks, s lets the dot match line breaks, u turns on full Unicode, and y matches only at the current position. Named groups are written (?<name>...).
In the replacement, $1 inserts the first group, $<name> a named group, $& the whole match and $$ a dollar sign. Patterns run in a separate worker with a time limit, so a pattern that backtracks endlessly stops with a message instead of freezing the page.
Private by design
Privacy
Everything runs in this page and stays on your device. Your pattern and text are tested inside this page.
This page also shows Google ads, which can use cookies. Privacy and cookies explains how.
Questions
Which regex flavour does this use?
JavaScript's, as in current browsers and Node.js. Most syntax matches PCRE, Python and Java, with small differences such as lookbehind support and flag names.
Why does my pattern only find the first match?
Add the g flag to find every match.
How do I use a captured group in the replacement?
Write $1 for the first group, $2 for the second, or $<name> for a named group (?<name>...).
Why did the tester stop my pattern?
Some patterns, such as nested repeats like (a+)+, can take exponential time on certain text. The tester stops after a short time limit; simplify the repeats to fix it.