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
Without slashes — they're drawn around the field for you.
Default is g (global). Add i for case-insensitive, m for multiline ^$.
The right pane highlights matches live.
Numbered and named captures appear under each match.
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
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 groupa|ba or b