Skip to content
M2TOOLKIT

Regex Tester

Test regular expressions against sample text with live highlighting and capture groups.

  • Free
  • No sign-up
  • Runs in your browser
/
/gi

Highlighted

Enter a pattern to test.

Matches and groups

No matches yet.
Regex cheat sheet
.any character except newline
\d \w \sdigit, word character, whitespace
\D \W \Snot digit / word / whitespace
[abc] [^abc]one of / none of a, b, c
a* a+ a?0+, 1+, 0 or 1 of a
a{3} a{2,5}exactly 3 / between 2 and 5
^ $start / end of string (or line with m)
\bword boundary
(abc) (?:abc)capture group / non-capturing group
(?<name>abc)named group
a|ba or b
(?=a) (?!a)followed by / not followed by a

Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us.

How to use the Regex Tester

  1. Type your pattern (without slashes).
  2. Tick the flags you need.
  3. Paste test text and see matches highlighted.
  4. Check each match's groups on the right.

What does this tool do?

The tester uses JavaScript's regular expression engine, so results match what you'll get in browsers and Node.js. It shows every match with its position, numbered groups and named groups.

Patterns run in a separate background worker with a time limit. If a pattern triggers catastrophic backtracking, it's stopped instead of freezing your browser.

Why use it?

  • Build and debug patterns quickly.
  • See groups for search-and-replace.
  • Safe against runaway patterns.

Example

Pattern (\w+)@(\w+)\.com with flags gi on “ada@example.com” matches the whole address, with “ada” as group 1 and “example” as group 2.

Accuracy and limits

  • Other languages' regex engines (PCRE, Python, Java) are similar but not identical — for example in lookbehind and Unicode support.

Privacy

Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us. There's no account to create and nothing to install.

Last reviewed by the M2Toolkit team.

Other tools people use alongside the regex tester.