How to use the regex tester
- Enter your pattern between the slashes at the top. Flags (
g,i,m,s,u,y) go in the second input. - Type or paste a test string on the left. Matches highlight live.
- Inspect capture groups in the "Matches with groups" list —
$0is the whole match,$1+ are the groups. - Use the Replace input to preview a substitution. Supports
$1,$2, and$&. - Dropdown presets give you a starting pattern for email, URL, IPv4, UUID, ISO date, phone, hex color.
JavaScript regex flags — what they do
- g — global. Find all matches, not just the first. Required for most tools to work usefully.
- i — case-insensitive.
- m — multiline.
^and$match at line boundaries, not just string boundaries. - s — dotall.
.matches newlines (off by default). - u — Unicode mode. Fixes surrogate-pair handling, enables
\\p{...}property classes. - y — sticky. Match only at
lastIndex; useful in lexers.
Catastrophic backtracking — the regex that kills your server
Patterns like (a+)+b can blow up exponentially on input like aaaaaaaaaaaaaaaaaaaaaaaaaaX.
The engine tries every split of the as before giving up. One user-submitted regex on your server
is a denial-of-service away.
Defenses:
- Avoid nested quantifiers on overlapping character classes.
- Use possessive quantifiers or atomic groups (not in JavaScript — use
(?=(X))\\1idiom). - Never run untrusted user regexes on your server without a timeout.
Named capture groups
Use (?<name>...) to name a group. Access in replacement with $<name>
and in code via match.groups.name. Much more maintainable than numeric groups once you have
more than two.
FAQ
Does this match PCRE or JavaScript flavor?
JavaScript. This tool uses your browser's native RegExp engine, so results match what your Node.js, Deno, or browser code will do. Some PCRE features (lookbehind has broader support, atomic groups) don't exist in JavaScript regex.
Can I test with large inputs?
Yes, but the highlighted matches are capped at 200 visible entries to keep the UI responsive. Matching itself handles up to 10,000 match iterations before safety-cutting.
Is anything sent to a server?
No. Everything runs in your browser.
Related tools
- JSON Formatter — Format, validate, and beautify JSON online. 100% client-side — your data never leaves your browser.
- URL Encoder / Decoder — Percent-encode and decode URLs per RFC 3986.
- XML Formatter — Format, validate, and beautify XML documents.
- HTTP Status Codes — Full HTTP status code reference with explanations and when to use each.
Pillar
Part of Dev Productivity — regex, cron, timestamps, HTTP, color, word counter, aspect ratio, case.
Written by Mian Ali Khalid. Last updated 2026-04-25.