Regex Tester

    Test JavaScript regular expressions with flags, matches, capture groups, named groups, highlighting, and replacement preview.

    //g

    Enter only the pattern between slashes: use \\d+ instead of /\\d+/g, then toggle the g flag.

    lt;name>" value=""/>

    Preview uses JavaScript replace: $1, $2, and

    lt;name> follow browser RegExp rules.

    Complex regular expressions on long input can slow down or briefly freeze this tab. For production validation, limit input length and execution time.

    Test JavaScript regular expressions

    Use this regex tester to check JavaScript RegExp patterns against sample text, inspect matches, review capture groups, and preview replacement output.

    • Enter the pattern without surrounding slashes.
    • Toggle common JavaScript flags: g, i, m, and s.
    • Review match indexes, numbered capture groups, and named capture groups.
    • Preview JavaScript replace output with $1, $2,
      amp;, and
      lt;name> syntax.

    Browser RegExp behavior

    The tool uses the browser's JavaScript RegExp engine. PCRE, Python, Java,.NET, and database regex engines may differ in lookbehind support, flags, escaping, named groups, and replacement syntax.

    pattern is the expression body, flags control matching mode, and matches are returned by JavaScript RegExp.

    Performance and safety

    Avoid catastrophic backtracking
    Complex regular expressions on long input can slow down or freeze a browser tab. Production systems should limit input length and execution time.

    The tester is useful for debugging and learning, but it is not a full regex debugger and does not guarantee identical behavior in every runtime.

    Frequently Asked Questions

    Sources and References

    Calculations are based on the listed reference sources. Links open in a new tab.

    Updated:

    Related Tools