Regex Tester (JavaScript) Free

Test a JavaScript regular expression with matches highlighted, capture groups listed, and a live replacement preview.

About this tool

Uses JavaScript's RegExp syntax, the same engine used by browsers and Node.js. Other languages, such as PHP or Python, differ in some details of syntax and behavior.

Supports the g, i, m, s, u, and y flags. A pattern that takes more than 1 second to run is stopped so the page does not freeze.

This tool runs entirely in your browser. Nothing you enter is sent to our server.

When to use it

Useful for trying out a regular expression for validation or log extraction before wiring it into code.

Also useful for checking exactly what a numbered group ($1, $2) or a named group captures, and what a replacement actually produces.

How to use

  1. Enter a pattern without the surrounding slashes, and check any flags you need.
  2. Type the text to test; matches are highlighted and listed along with their groups.
  3. To preview a replacement, enter it in "Replacement text" using $1, $2, or $<name> for groups.

What the flags do

g finds every match instead of stopping at the first one. i ignores uppercase/lowercase differences. m makes ^ and $ match the start and end of each line. s lets . match line breaks too. u treats the pattern as Unicode, enabling \u{...} and \p{...}. y matches only starting right where the previous match ended.

FAQ

Can I test regular expressions from PHP or Python here?
This tool runs JavaScript's RegExp engine. The basics are shared across languages, but details such as lookbehind support, named groups, and flag syntax can differ.
Why did it say "stopped because it took more than 1 second"?
Patterns with nested repetition, like (a+)+, can take an extremely long time to fail on certain strings. The tool stops after 1 second so the page doesn't freeze; try restructuring the pattern to avoid nested repeats.
Is my text sent anywhere?
No. The pattern runs entirely in your browser.