DEVELOPER TOOLS

Regex Tester

Try a JavaScript regular expression against sample text. Review every match, capture group, and replacement locally in this browser.

Enter the pattern without slash delimiters. JavaScript syntax is used; maximum 512 characters.

Flags

Maximum 100,000 characters. Match indexes use JavaScript string offsets (UTF-16 code units).

Maximum 100,000 characters. Replacement uses standard JavaScript tokens such as $&, $1, and $<name>. It is plain text, never code.

Enter a regular expression and test text.

Matches and captures

  • Run a test to see matches.

Test text with matches

No test text to show.

Replacement preview

Run a test to preview replacement text.

Using the Regex Tester

Enter a JavaScript regular expression and test text, choose any combination of the listed flags, then run the test. The g flag finds all non-overlapping matches; without it, only the first match is reported. At most 1,000 matches and a 2,000,000-character replacement preview are processed. Captures include numbered groups and named groups. An optional group that did not participate is shown as “unmatched.”

The replacement preview follows JavaScript string replacement rules, including tokens such as $1 and $<name>. It does not run replacement code. Empty patterns are valid and can match between characters; global zero-length matches advance safely, by Unicode code point when u is selected.

Matching runs in a local Web Worker with a 500 ms worker budget so an expensive pattern does not block the page. If it exceeds that budget, the worker is stopped; browser scheduling varies, so this is not a formal regex-engine timeout guarantee. Some patterns can trigger catastrophic backtracking and take a long time in regex engines. Keep patterns and test text modest, and avoid ambiguous nested quantifiers such as (a+)+ on long input. This tool does not persist or send your text.