Test regular expressions live

A free online JavaScript regex tester that runs in your browser. Type a pattern, optionally tweak the flags (g/i/m/s/u/y), and the right pane highlights every match in real time with alternating colours so adjacent hits stay distinct. The match list shows numbered captures and named groups; the replacement field gives a live preview of String.prototype.replace() with $1 $2 backreferences. Built-in safety guard against catastrophic-backtracking infinite loops on zero-width matches.

How to use

1
Enter your pattern

Without slashes — they're drawn around the field for you.

2
Adjust flags

Default is g (global). Add i for case-insensitive, m for multiline ^$.

3
Paste a test string

The right pane highlights matches live.

4
Inspect groups

Numbered and named captures appear under each match.

5
Optionally preview Replace

Type a replacement to see the substituted output.

Live JavaScript regex testing with highlighted matches and replacement preview

/ /
g global · i case-insensitive · m multiline ^$ · s . matches \n · u unicode · y sticky
Test string
Highlighted matches 0
No matches yet.

Cheat sheet

\ddigit 0-9
\wword char
\swhitespace
.any char
^ $start, end
* + ?0+, 1+, 0/1
{n,m}n to m times
[abc]character class
(...)capture group
(?:..)non-capturing
(?<n>..)named group
a|ba or b
Published