Skip to content

Regex Tester

Write a regular expression with its flags, paste some test text, and see every match highlighted with its position and captured groups. A fast way to build and debug patterns like email or phone validators.

What each field means

Every input below changes the result in a specific way. This is what each one expects, what it starts at, and the range it accepts.

Pattern

Text that you supply. The calculator works on exactly what you type.

Flags

Text that you supply. The calculator works on exactly what you type.

Test text

Text that you supply. The calculator works on exactly what you type.

How to read your result

The calculator reports the figures below. The headline figure answers the question in the title; the rows underneath break it down so you can see what drives it.

Matches
This figure updates as you change the inputs above. It is a direct output of the formula, not an estimate of future market or lender outcomes.
Pattern
This figure updates as you change the inputs above. It is a direct output of the formula, not an estimate of future market or lender outcomes.
First match
This figure updates as you change the inputs above. It is a direct output of the formula, not an estimate of future market or lender outcomes.
Text length
This figure updates as you change the inputs above. It is a direct output of the formula, not an estimate of future market or lender outcomes.
Matches
This figure updates as you change the inputs above. It is a direct output of the formula, not an estimate of future market or lender outcomes.
Match characters
This figure updates as you change the inputs above. It is a direct output of the formula, not an estimate of future market or lender outcomes.

Quick reference

CodeMeaning
.Any single character except a line break.
\dAny digit, equivalent to the class [0-9].
\wAny word character: a letter, a digit or an underscore.
\sAny whitespace character, including spaces and tabs.
^ $Anchors that match the start and the end of the string.
* + ?Repetition: zero or more, one or more, or optional.
[ ]A character class, such as [aeiou] to match vowels.
( )A capturing group, which records the part of the match it covers.
|Alternation, meaning either the left pattern or the right one.
\.A backslash escapes a metacharacter so it matches itself literally.

What this means

A regular expression is a pattern language for finding text. The tester applies your pattern to each line of test text and lists every match with the character range where it was found.

How we calculate it

Formula

new RegExp(pattern, flags) tested over the text; each match records its index and the captured groups.

Worked example

Pattern [a-z]+@[a-z]+\.com against an email list:

  1. 1Enter the pattern and flags.
  2. 2Paste the text to test.
  3. 3Read the match list and positions.

Important assumptions

  • Patterns use JavaScript regex syntax, including flags like g, i and m.

Frequently asked questions

What do the flags do?

g matches globally, i is case-insensitive, m makes ^ and $ match line boundaries, s lets . match newlines.

Why does my pattern match nothing?

Check escaping — for a literal dot use \., and remember that + and * apply to the previous element.

Related tools