Nothing uploaded

Regex tester

Write a regular expression, paste some text and see the matches highlighted, with their capture groups. Try replacements with $1 and named groups.

Without the slashes around it, for example \d{3}-\d{4}

Flags
Find all matches, not just the first.
a also matches A.
^ and $ match at each line.
. also matches line breaks.
Emoji count as one character; \p{…} works.
Match only where the last match ended.

Matches

Each match

    What you type stays on this device. Nothing is uploaded.

    How to test a regular expression

    1. Type your regular expression, without the slashes, and choose the flags.
    2. Paste the text to test. Matches are highlighted and listed with their capture groups.
    3. To replace, turn on Replace matches and type the replacement: $1 is the first group, $<name> a named group.

    Questions

    Is my text sent anywhere?

    No. Matching happens in your browser on this device, so log files, emails and customer data never leave it.

    Which regex flavour is this?

    JavaScript (ECMAScript), as run by your browser. Most syntax is the same as in Python, Java, PHP and .NET, but a few features differ: JavaScript has no possessive quantifiers or atomic groups, for example.

    Why did it stop after one second?

    Some patterns, like (a+)+$, can take an extremely long time on certain text, which is called catastrophic backtracking. The tool stops after a second so your browser doesn’t freeze. Make the pattern more specific, for example by avoiding repetition inside repetition.

    How do I use groups in the replacement?

    $1, $2 and so on insert numbered groups, $<name> a named group (?<name>…), $& the whole match and $$ a dollar sign.