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
| Code | Meaning |
|---|---|
. | Any single character except a line break. |
\d | Any digit, equivalent to the class [0-9]. |
\w | Any word character: a letter, a digit or an underscore. |
\s | Any 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:
- 1Enter the pattern and flags.
- 2Paste the text to test.
- 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
JSON Formatter
Format, minify and validate JSON with one click.
Base64 Encoder
Encode any text, including Unicode, to Base64.
Hash Generator
Generate MD5, SHA-1 and SHA-256 hashes of any text.
Base64 Decoder
Decode Base64 strings back to readable text.
URL Encoder
Encode text for safe use inside URLs and query strings.
URL Decoder
Decode percent-encoded URLs back to readable text.