Skip to content
Calculator Tools
Developer Tools

Regex Tester

Test a regular expression against sample text and see every match and capture group.

Enter values

Results update as you type.

Result

Matches found

2

Pattern
/(\w+)@(\w+)\.com/g
Capture groups
2
First match
alice@example.com
Characters matched
29
Replaced with an empty string
Contact or today.

Matches

#MatchPositionGroups
1alice@example.com8alice | example
2bob@test.com29bob | test

About the Regex Tester

Write a pattern, paste some text, and see exactly what matches. Capture groups are listed for each match along with their position, which is usually what you need when a pattern almost works but not quite. Everything runs in your browser using the same engine your JavaScript will use.

Also known as: regular expression tester, regex match tester, test regex, regexp checker, pattern matcher.

How to use this calculator

  1. Enter pattern, test text, global (find all matches), ignore case and the other fields.
  2. The result updates instantly as you type — press Calculate (or Enter) at any time.
  3. Review the breakdown shown under the main result.
  4. Use Copy result or Share to save the answer or send a link with your inputs.

Formula

Your pattern is compiled with the flags chosen and run against the text

Worked example

Using the values pre-filled in the calculator above:

  • Pattern: (\w+)@(\w+)\.com
  • Test text: Contact alice@example.com or bob@test.com today.
  • Global (find all matches): yes
  • Ignore case: no
  • Multiline (^ and $ match each line): no

the calculator returns:

  • Matches found: 2
  • Pattern: /(\w+)@(\w+)\.com/g
  • Capture groups: 2
  • First match: alice@example.com

Tips & common mistakes

  • Escape a literal dot as \. — an unescaped dot matches any character.
  • Use \d for digits, \w for word characters and \s for whitespace.

Frequently asked questions

Why is a nested quantifier rejected?

Patterns such as (a+)+ can take exponential time on some inputs and lock up the page. Rewrite them with a single quantifier.

Which regex flavour is this?

JavaScript’s — the same engine your browser and Node use, so what works here works in your code.