Regex Tester: Test JavaScript Regular Expressions

Test regular expressions live. Matches are highlighted in your text as you type, with every capture group listed, and a replace preview that shows exactly what a find-and-replace would do.

g
Matches
Replace
Result

        

Uses JavaScript regular expressions, the same flavor as browsers and Node.js.

Runs in your browser. Nothing you enter is sent or saved.

How to test a regex

  1. Type your pattern in the top box, or pick one from Common patterns.
  2. Turn on the flags you need: global, ignore case, multiline, dot-matches-newline or Unicode.
  3. Paste your test text. Matches are highlighted and listed with their position and groups.
  4. Open Replace to try a replacement using $1, $<name> or $&, then copy the result.

Features

  • Live highlighting of every match, with alternating colors so neighbors are easy to tell apart.
  • Capture groups, numbered and named, shown for each match.
  • Replace preview using standard JavaScript replacement syntax.
  • Ready-made patterns for email addresses, URLs, US phone numbers, ZIP codes, dates, IPv4 addresses and hex colors.
  • Safe with slow patterns: a pattern that runs too long is stopped with an explanation instead of freezing the page.

Frequently asked questions

Which regex flavor does this use?

JavaScript regular expressions, the same flavor used by web browsers and Node.js. Most syntax also works in Python, PHP and Java, but some features differ.

What do the flags mean?

g finds every match, not just the first. i ignores upper and lower case. m makes ^ and $ match at each line. s lets the dot match line breaks. u turns on full Unicode support.

Why did my pattern get stopped?

Some patterns, such as nested repeats like (a+)+, can take an extremely long time on certain text. This is called catastrophic backtracking. The tester stops after 1.5 seconds so your browser stays responsive.

Is my text sent anywhere?

No. Matching runs entirely in your browser.

Need a custom version of this tool or an API for your business? Get in touch.