Regular Expression Tester
Type a pattern and see every match highlighted as you go, with capture groups and named groups listed for each one. Add a replacement template to preview the result of `String.replace`.
Matches, groups and positions
Every match is listed with its character offset, its full text and each capture group, including named groups written as `(?<name>...)`. Seeing the offsets makes it obvious when a greedy quantifier has swallowed more than you intended, or when a lookahead is matching at an unexpected position.
Replacement preview
Enter a replacement template using `$1`, `$<name>` or `$&` and the tool shows the rewritten text immediately. This is the fastest way to build a find-and-replace before running it across a codebase, where a mistake is expensive to undo.
Flags, and the ones that matter most
`g` finds every match rather than only the first, `i` ignores case, `m` makes `^` and `$` match at line boundaries rather than only at the ends of the string, and `s` lets `.` match newlines. `u` enables full Unicode handling, which you want whenever the subject contains emoji or non-Latin scripts.
Frequently asked questions
Is my pattern or text uploaded?
No. Nothing you paste leaves your browser. The page loads a small amount of JavaScript, and every calculation happens on your own machine - there is no server to send data to. The pattern is compiled with the browser's own regular-expression engine, so you can safely test against real log lines or customer data.
Which regex flavour is this?
JavaScript (ECMAScript), the same engine your browser and Node.js use. It is close to PCRE but not identical: there are no possessive quantifiers or recursion, and lookbehind requires a reasonably modern browser. Patterns written for Python or PHP usually work, but verify the edge cases.
Why does my pattern match nothing?
The most common reasons are a missing `g` flag when you expected several matches, a `.` that cannot cross the newline you are trying to span (add `s`), an unescaped special character such as `.` or `?` that should be literal, or leading and trailing whitespace in the subject that you did not account for.
Why is my expression so slow?
Nested quantifiers over overlapping alternatives - the classic `(a+)+` shape - can backtrack catastrophically, taking exponential time on input that nearly matches. Make the inner parts more specific, anchor the pattern, or replace the nesting with a single character class.