OKFree Tools
Developer

Regex Tester

Highlight regular expression matches as you type, list every match and capture group, and start from common patterns

Runs locally in your browser. Nothing is uploaded.

Regular expression

Flags
Common patterns

Test text

Matches

Enter a regular expression or pick a common pattern

Replace preview

$1 group 1$<name> named group$& whole match$$ a literal $

Enter a valid pattern and some test text to see the replaced text here

How to use

  1. 1
    Write a pattern

    Type a regular expression at the top or pick a common pattern. Turn on the flags you need, such as g for every match or i to ignore case.

  2. 2
    Add test text

    Paste the text to check. Matches are highlighted right away, and the match list shows each index and group.

  3. 3
    Preview the replacement

    Use $1, $& and friends in “Replace with” to reuse matched text, then copy the result.

Tips

  • Catastrophic backtracking

    Nested quantifiers such as (a+)+ or (.*)* get exponentially slower on text that doesn’t match. Matching stops here after 1.5 seconds; rewrite the pattern before you use it in code.

  • Escaping in code

    Enter the part between the slashes. In a JavaScript string (new RegExp("…")) every backslash has to be doubled, so \d becomes \\d.

  • Engine differences

    This uses your browser’s JavaScript regex engine. Python, Java and PCRE share most of the syntax, but named groups, lookbehind and Unicode classes are written differently, so test again when you switch languages.