Regex Tester
Type a pattern and watch every match light up as you go — with captured groups, named groups and a replace preview.
Writing and testing a regular expression
A regular expression describes a pattern of characters. In the field above you write the pattern
between the slashes and toggle the flags beside it: g finds every match instead of
stopping at the first, i ignores case, m makes ^ and
$ match at every line break, s lets . span line breaks,
u enables full Unicode matching and y anchors each attempt at the
previous match position. Matching starts as soon as you type — there is no submit step, so you can
iterate on a pattern and watch the highlighting change.
The match list below the text shows each hit with its character offsets, the full match and every
capture group (numbered and named), which is the fastest way to debug a pattern that "almost"
works. The replace box applies the pattern through String.replace(), so
$& inserts the whole match, $1 the first group and
$<name> a named group.
FAQ
Which regex flavor is this?
JavaScript (ECMAScript), the exact engine your browser and Node.js use — named groups, lookbehind (?<=…) and Unicode property escapes are all supported. PCRE-only syntax such as \A or (?P<name>…) is not.
Why did the page freeze on my pattern?
Nested quantifiers like (a+)+$ can cause catastrophic backtracking, and no regex tester can rescue that — rewrite the pattern so each part is unambiguous. This tool caps the match list at 2000 results to keep very broad patterns responsive.
Is my text sent anywhere?
No. Matching and replacing run entirely in your browser, which makes the tool safe for logs and production data.