Test, validate, and analyze your regular expressions in real-time. JavaScript regex tester with live pattern highlighting, flag modifiers, and match analytics.
$1, $2 group references before using the
pattern in your code.
What this tester actually does under the hood, with a worked example for each feature, plus answers to the questions we get asked most.
Most simple regex checkers only tell you whether a pattern matched somewhere in the text — they don't show you where.
This tester overlays your test string with a transparent highlight
layer, so every match is marked directly inside the text as you
type, using the pattern [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
against a block of text containing three email addresses highlights
all three at once, updating on every keystroke in the pattern or the
text box.
Every match is also listed separately below the text area, showing its index position in the string and, if your pattern has parentheses, the individual captured groups.
A pattern like ([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})
against admin@toolmato.org produces:
That makes it easy to confirm your groups are capturing the right pieces before you copy the pattern into your own code.
Switching to Replace mode lets you test a substitution string
alongside your pattern, including group references like
$1 and $2, and shows the resulting output
live.
With the pattern above and a replacement of $1 (at) $2,
the text
Contact admin@toolmato.org for help becomes:
This is useful for confirming a masking or reformatting pattern behaves correctly before wiring it into real code.
A built-in dropdown fills in ready-made patterns for frequent
use cases — email, URL, US phone number, IPv4 address,
YYYY-MM-DD date, hex color code, and basic username
validation — so you don't have to write or remember them from
scratch.
Selecting the "IPv4 address" preset instantly loads
\b(?:\d{1,3}\.){3}\d{1,3}\b into the pattern field and
re-runs it against whatever text is already in the box.
Before running your pattern, the tool checks it for common shapes
known to cause catastrophic backtracking — nested quantifiers like
(a+)+ or (a*)* — and flags a warning if it
finds one.
Typing a pattern like (a+)+$ shows a warning that the
pattern may cause severe slowdowns on certain inputs, before it has
a chance to freeze your browser tab on a long test string — a check
most free online regex testers skip entirely.
Matches are highlighted directly inside your test string, not just reported as a count.
Each match lists its captured groups individually, so you can confirm your pattern extracts the right pieces.
Nested-quantifier patterns that can freeze a browser tab are surfaced as a warning before you run them.
RegExp engine, the
same one that runs in every browser and in Node.js. Patterns
you test here will behave identically when used in JavaScript
code, but syntax specific to other languages, like Python's
named groups written as (?P<name>...), may
need adjusting for JS's (?<name>...) syntax.
^ and
$ match the start and end of each line rather
than only the start and end of the whole string.
s (dot-all) makes . also match
newline characters, which it otherwise doesn't.
(a+)+, can cause the regex engine to try an
exponentially growing number of combinations on certain
non-matching input, freezing the page. This tester scans your
pattern for that shape and shows a warning so you can simplify
it before it causes a slowdown.