Developer tools

Regex Tester: Test Regular Expressions Online

Test a regular expression against your text and see every match highlighted as you type, with capture groups (named ones too) and a live replace preview. It follows JavaScript regex rules, and a pattern that runs too long is stopped instead of freezing the page.

Flags

Patterns run on your device, with the same rules as JavaScript in your browser. Nothing you type is sent anywhere.

How to use the Regex Tester

  1. Type your pattern and tick the flags you need.
  2. Paste the text to test. Matches are highlighted and listed with their groups.
  3. Turn on Replace to preview a substitution, then copy the result.

Frequently asked questions

Which regex flavour does this use?
JavaScript's. Most everyday syntax is shared with Python, Java and PCRE, but lookbehind, named groups and Unicode classes can differ slightly between languages.
What do the flags do?
g finds every match, i ignores case, m makes ^ and $ match at each line, s lets . match line breaks, u turns on full Unicode support and y matches only at the current position.
How do I use groups in the replacement?
Use $1, $2 and so on for numbered groups, $<name> for named groups and $& for the whole match.
Why was my pattern stopped?
Some patterns, often nested repeats like (a+)+, can take practically forever on certain text. The tester stops any run after one second so the page stays responsive.
Is my text sent anywhere?
No. Matching happens on your device.