Regex tester

Build and debug regular expressions against real text. Matches highlight as you type, with capture groups and a replacement preview.

  • Free
  • Private
  • No sign-up
Examples:

Matches

#MatchGroups
Stays on this device. Network requests since you started: 0 How to check this yourself

How your text and data are handled

  1. Your text and dataRead from your device
  2. Worked on in this tabBy code running in your browser
  3. Ready to copyNothing is stored

Never sent to a server. See how to check

How to use it

  1. Type a pattern and flags.

  2. Paste the text to test.

  3. Review highlighted matches, groups and the replace preview.

About this tool

Patterns use the JavaScript (ECMAScript) regular expression syntax, including named groups (?<name>...), lookbehind and the flags g, i, m, s, u, y, d and v. Other engines (PCRE, Python, .NET) are similar but not identical, so test there too before relying on a pattern.

Each test runs in a background worker with a 1.5-second limit. Patterns with nested quantifiers such as (a+)+ can take exponential time on some inputs ("catastrophic backtracking"); the tester stops them instead of freezing your browser, a useful warning before such a pattern reaches production.

Good to know

  • JavaScript regex syntax only.
  • Shows up to 5,000 matches; the table lists the first 200.

Frequently asked questions

What does the g flag do?

It finds all matches instead of only the first. i makes matching case-insensitive and m makes ^ and $ match at line breaks.

Why did my pattern time out?

It probably causes catastrophic backtracking. Avoid nested quantifiers like (a+)+ and use more specific character classes.

How do I use capture groups in the replacement?

Use $1, $2 for numbered groups and $<name> for named groups.

You might also need