Skip to content
Dev Utilities

Regex tester

Test a regular expression against sample text with match highlighting

A pattern can freeze this tab. JavaScript's regex engine backtracks, and some patterns take exponential time on input that nearly matches. Matching is synchronous and cannot be interrupted, so there is no timeout that would save you — if the page stops responding, reload it. The sample is capped at 50,000 characters and matching stops after 500 matches, which limits the damage but does not prevent it.

/gm
Flags
0 chars
0 matches0 numbered groups

Handled by String.prototype.replace, so $1$9, $<name>, $& and $$ all mean what they mean there. Without the g flag only the first match is replaced.

Everything runs in this tab against JavaScript's own RegExp, so what you see is exactly what your browser does — not PCRE, not Python's re, not Go's RE2. Lookbehind, named groups and \p{…} property escapes are available; possessive quantifiers, atomic groups and recursion are not, because JavaScript has none of them.