Test regular expressions and understand them
This tester highlights every match live as you type and gives a plain-English, step-by-step explanation of what each part of your pattern does — something most regex tools skip. It is built for developers writing and debugging patterns, and for anyone learning regex who wants to know why a pattern matches.
How it works
Your pattern and flags are compiled with the browser’s native
new RegExp(pattern, flags) — the exact JavaScript engine your code will use, so
behaviour matches production. For highlighting, the tester forces the global flag
(g) internally and runs test.replace(regex, ...) to wrap every match in a
highlight, even if you didn’t type g. If the pattern is invalid, the RegExp
constructor’s error is shown instead. Separately, a lightweight tokeniser walks
the pattern left to right and emits a sentence per token (character class,
quantifier, anchor, group, alternation, and so on) for the explanation panel.
Example
Pattern \b\d{4}-\d{2}-\d{2}\b with the g flag, tested against:
Invoices dated 2026-05-30 and 2026-06-01 are due.
highlights both 2026-05-30 and 2026-06-01. The explainer breaks it down as:
word boundary, four digits, a literal hyphen, two digits, a hyphen, two digits,
word boundary — i.e. an ISO-style date.
Flag reference
| Flag | Name | Effect |
|---|---|---|
g | global | Match every occurrence, not just the first |
i | ignore case | Case-insensitive matching |
m | multiline | ^ and $ match at each line break |
s | dotall | . also matches newline characters |
Everything runs locally in your browser — your pattern and text are never uploaded.