Regex Tester
🔒 Runs in your browser
Cheatsheet (click to insert)
Character classes
Anchors
Quantifiers
Groups & alternation
Lookaround
JavaScript regex, with full group visibility
Patterns run through the native RegExp engine, so behavior matches exactly what
your own JavaScript code would do — including JavaScript-specific syntax like named groups
and the s/u/y flags. Every match lists its numbered and
named capturing groups in the order the pattern declares them, and Replace mode supports the
same $1/named-group substitution as String.replace.
A runaway pattern can never freeze this page
Certain patterns are pathologically slow on the wrong input — a phenomenon called catastrophic backtracking — and can block whatever thread runs them for seconds, minutes, or longer. Every test and replace here runs inside a dedicated background worker with a two-second limit: if a pattern has not returned by then, the worker is terminated and a fresh one is spun up automatically, so a bad pattern only ever costs two seconds, never a frozen tab.
Frequently asked questions
What regex flavor does this tool use?
JavaScript's native regular expressions (the ECMAScript RegExp engine) — mostly compatible with PCRE/Python, but details like named-group syntax, lookbehind support and flag letters are JavaScript-specific.
How are named and numbered groups shown?
Every capturing group appears in the match list in the order it is declared in the pattern, together with its name if it has one (otherwise a numbered label) and the exact substring it captured.
What does Replace mode do?
Replace mode substitutes every match with a template you write, where $1, $2… refer to numbered groups and a dollar sign followed by the group name in angle brackets refers to named ones — the same syntax as JavaScript’s String.replace.
Why would a pattern time out after two seconds?
Certain patterns (for example a repeated group nested inside another repeated group) can trigger catastrophic backtracking on non-matching input, freezing whatever runs them. Testing always happens in a background worker with a two-second limit, so a runaway pattern is stopped automatically instead of freezing this page.