Regex Tester

Type a regular expression and some text to see every match highlighted, with its position and capture groups. Add a replacement to preview the result. Patterns that would hang are stopped safely.

JavaScript syntax. Paste /pattern/flags to fill in both.
Flags

TEST TEXT

0 characters0 lines

RESULT

Matches are highlighted here as you type a pattern and some text.

Runs entirely in your browser. Nothing you enter is sent to a server.

How to test a regular expression

  1. Write the pattern

    Type the pattern without slashes and tick the flags you need. You can also paste a literal like /ab+c/gi and it's split for you.

  2. Add test text

    Paste sample lines, log entries or data. Matches are highlighted and listed with their index and groups.

  3. Preview a replacement

    Type a replacement using $1, $<name> or $& to see the replaced text, then copy it.

JavaScript regular expressions

Patterns run on your browser's own JavaScript engine, so the results match what JavaScript and TypeScript code does, including named groups, lookbehind and Unicode property escapes such as \p{L} with the u flag. Other languages (PCRE, Python, .NET) differ in a few details.

Safe from catastrophic backtracking

Some patterns, such as (a+)+$, can take minutes on a long line. Matching runs in a background worker and is stopped after 1.5 seconds, so the page never freezes. A message tells you when that happens.

Frequently asked questions

What do the flags do?

g finds all matches instead of the first, i ignores case, m makes ^ and $ match at line breaks, s lets the dot match line breaks, u enables full Unicode, and y matches only at the current position.

Why is the match list cut off?

The first 500 matches are listed and highlighted, and the total number of matches is shown. The replacement preview always covers the whole text.

Is my text sent anywhere?

No. The pattern and the text stay in your browser.