Regex tester

Type a regular expression and some text to see every match highlighted, with its capture groups, and try a replacement.

Your files stay on your device. Nothing is uploaded.

Regex tester

Stops patterns that run too long

Step 1: Type the pattern

Flags

Step 2: Paste text to test

Step 3: Matches


    
    
    

How to test a regular expression

  1. Type the pattern

    Type the pattern without the slashes, and tick the flags you need.

  2. Paste test text

    Matches are highlighted as you type, and listed with their position and groups.

  3. Try a replacement

    Type a replacement such as $2/$1 to see the text after replacing.

About this tool

JavaScript flavour

Patterns run with your browser's own regular expression engine, the same one used by JavaScript and TypeScript code, including named groups, lookbehind and Unicode.

Never freezes

Some patterns, such as (a+)+ on a long line, can take practically forever. Matching runs separately from the page and is stopped after 1.5 seconds, with an explanation, so the page never hangs.

Groups and replace

Each match lists its numbered groups ($1, $2) and named groups. The replace box uses the same $1, $<name> and $& codes as JavaScript.

Privacy

This tool runs in your browser, on your own device. Your files and text are not uploaded to our server and we cannot see them. When you close or reload this tab, they are cleared, along with the results.

Frequently asked questions

What do the flags mean?

g finds every match, i ignores capital letters, m makes ^ and $ work per line, s lets . match line breaks, and u turns on full Unicode.

Will my pattern work in PHP or Python?

Usually, for common patterns. Some features differ between languages, such as lookbehind and named group syntax.

Is my text uploaded?

No. It runs in your browser, so nothing you type or choose is sent anywhere.

Can I replace text in a document?

Yes, use Find and replace, which also supports regular expressions.