dilettanteee

Regex Tester

Live matches and capture groups for a regular expression.

Test text
Matches

Matches appear here.

About Regex Tester

The Regex Tester lets you write a regular expression and see, live, exactly what it matches in a block of sample text. Every match is listed along with its capture groups, so you can debug a pattern before it goes into your code.

How to use it

  1. Enter your pattern in the pattern field, without surrounding slashes.
  2. Toggle the flags you need: i for case-insensitive matching, m for multiline, s so the dot also matches newlines, and u for full Unicode support.
  3. Paste the text you want to test the pattern against.
  4. Review the match count and the list of matches and capture groups.

Good to know

  • The tester uses JavaScript regular expression syntax, which is what runs in browsers and Node.js. Other languages have small differences, such as in lookbehind support and named groups.
  • The global flag is always applied so that every match is found, not only the first.
  • An invalid pattern is reported with the engine's own error message instead of failing silently.

Common questions

Why does my pattern work elsewhere but not here?

Different languages use different regex flavors. Python, PCRE and .NET support features that JavaScript does not, and the reverse. Rewrite the pattern using JavaScript syntax to test it here.

What are capture groups?

Parentheses in a pattern capture the part of the text they match. Each match is shown with the value captured by every group, which is useful for extracting pieces such as the parts of a date.