Regex Tester & Matcher

Build, highlight, replace, and inspect JavaScript regex matches with numbered and named capture groups.

Workspace

Expression

Build and test a pattern

0 / 2,000
Flags

Match highlighting

0 found
Matching text will be highlighted here.

Replace preview

Test a replacement

Use $& for the complete match, $1 for a numbered group, or $<name> for a named group. Turn off Global to replace only the first match.

Match details

Matches and capture groups

0 found

Enter a pattern and sample text to inspect matches.

Guide

How to use

  1. Enter a JavaScript regular expression or load an example, then choose the matching flags.
  2. Paste sample text and review live highlighting, match boundaries, numbered groups, and named groups.
  3. Enter replacement syntax such as $&, $1, or $<name> and compare the preview without changing the sample.
  4. Copy the expression or replacement result, or download match and group details as CSV.
Help

Frequently asked questions

Which regular-expression syntax is supported?

Use JavaScript regular-expression syntax, including numbered groups, named groups, backreferences, lookarounds, character classes, and the displayed flags when supported by your browser.

What does the Global flag change?

With Global enabled, every non-overlapping match is listed and replaced. Turn it off to inspect and replace only the first match.

How do replacement references work?

Use $& for the complete match, $1 and $2 for numbered capture groups, and $<name> for a named capture group.

What happens if a pattern takes too long?

A test that exceeds the time limit is stopped and shows an error. The sample is limited to 100,000 characters, the expression to 2,000 characters, and displayed matches to 500.