Regex Tester

    Regex Tester

    Test and debug regular expressions

    About the Regex Tester

    Regular expressions are the Swiss army knife of pattern matching — used in form validation, log parsing, code search, routing rules, and data extraction. They're also notoriously hard to debug because a single character can change matching behavior dramatically. This tester runs your regex in a Web Worker so a catastrophic pattern can't freeze the page, and highlights every match with its capture groups inline.

    Features

    How it works

    1. Type your regex pattern (no need for leading / trailing slashes).
    2. Toggle the flags you need — g, i, m, s.
    3. Paste your test string.
    4. See matches highlighted in real time; inspect capture groups below.

    Use cases

    Frequently asked questions

    Why does my regex hang on some inputs?

    +

    Nested quantifiers like (a+)+b cause catastrophic backtracking on non-matching strings. The engine explores exponentially many paths. Our Web Worker implementation kills the regex at 1.5 s.

    What are named capture groups?

    +

    Groups of the form (?<name>pattern) that you can reference by name in the result, e.g., match.groups.name. Much clearer than numbered groups for complex regex.

    Does this support lookbehind?

    +

    Yes — lookbehind ((?<=) and (?<!)) is supported in modern browsers. IE and older Safari don't support it.

    Why does removing the 'g' flag change the match count?

    +

    Without 'g', .match() and .exec() only return the first match. With 'g', they return every match. The tool faithfully mirrors this behavior.

    Can I use this to replace text?

    +

    Substitution mode is on the roadmap. For now, use the match output to reason about what your regex captures.