Runs in your browser

Regex Tester

Test JavaScript regular expressions.

Part of the Developer Tools bot
Processed in your browser
Result

        
        
        
      

About the Regex Tester

This regex tester checks JavaScript regular expressions against your text with instant highlighting. See every match, capture group and position, try replacements, get a plain-English breakdown of the pattern, and stay safe from patterns that would freeze the page.

How to test a regular expression

  1. Type a pattern (without the surrounding slashes) and pick flags like g or i.
  2. Paste text to search. Matches are highlighted instantly.
  3. Open Match list for positions and capture groups, or Explain for a breakdown of the pattern.
  4. Tick Replace with to test replacements using $1 or $<name>.

JavaScript regex, exactly

Patterns run on your browser's own regex engine, the same one used by JavaScript and Node.js, so what matches here matches in your code.

Protection from runaway patterns

Some patterns, like (a+)+$, can take forever on certain input (“catastrophic backtracking”). Each test runs in a background thread and is stopped after one second, with a warning, so the page never freezes.

Questions

Which regex flavour is this?

JavaScript (ECMAScript). It supports lookahead and lookbehind, named groups (?<name>…), Unicode property escapes \p{L} with the u flag, and the s (dotAll) flag.

How do I reference groups in a replacement?

Use $1, $2 for numbered groups, $<name> for named groups, $& for the whole match and $$ for a literal dollar sign.

Is my text uploaded?

No. Everything runs in your browser.

Also searched as: regular expression tester · regex checker · javascript regex tester · test regex online · regex101 alternative · regex builder