Regex Tester

Test JavaScript regular expressions against sample text, inspect matches and capture groups, preview replacements, and explore common syntax.

2 matches

Highlighted matches

Contact ops@example.com or sales@example.com.
Shipped 2025-03-14 with #4338ca and 8.8.8.8.

Match details

  • #1 · characters 8–23ops@example.com$1: ops
  • #2 · characters 27–44sales@example.com$1: sales

What is a regex tester?

A regex tester runs a regular expression against sample text so you can see exactly what each pattern matches before it ships. It highlights every match, exposes capture groups, and runs with the flags you choose (global, case-insensitive, multiline, unicode).

It is the fastest way to debug a pattern that "almost works": add one token at a time, watch the match list change, read the token-by-token explanation, and confirm the group indices your code will read.

How to test a regular expression

  1. Type the pattern into the expression field, or paste a literal such as /foo/gi - the optional slashes and flags are detected for you.
  2. Toggle the g / i / m / s / u / y flag chips. The active flags are shown next to the pattern.
  3. Paste the text to test in the Match tab; matches highlight live and the counter shows how many were found.
  4. Step through matches with the arrows and click one to focus it. The details list shows the range, capture groups and named groups.
  5. Switch to Replace to preview a substitution using $1 for groups, $& for the whole match or $<name> for named groups.
  6. Open Explain for a token-by-token breakdown of the pattern, or Reference for a quick cheatsheet - clicking any token inserts it straight into the pattern.
  7. Start from a Common pattern when you need a known-good baseline such as an email or URL.

Regex examples

Capture a date

Pattern: (\d{4})-(\d{2})-(\d{2})
Text: shipped 2025-03-14
Match: 2025-03-14
Group 1: 2025  Group 2: 03  Group 3: 14

Find every e-mail

Pattern: [\w.+-]+@[\w-]+\.[a-z]{2,}
Text: ping ops@example.com or sales@example.com
2 matches: ops@example.com, sales@example.com

Replace with a group

Pattern: (\d{4})-(\d{2})-(\d{2})
Replacement: $3/$2/$1
2025-03-14 becomes 14/03/2025

Read the explanation

Pattern: ^\d{3,}$
^ = start of string
\d = any digit
{3,} = three or more times
$ = end of string

Regex tester vs regex101 and RegExr

DimensionThis testerregex101RegExr
Regex engineJavaScript / ECMAScriptPCRE2, JavaScript, Python, Go, Java, .NET, Rust, POSIXJavaScript and PHP/PCRE
Live highlightYes, while you typeYesYes, real time
ExplanationToken by token, indented by groupToken by token plus a step debuggerTooltips through the reference
Quick referenceClick a token to insert itClick a token to insert itClick a token to insert it
Replace previewBuilt in, with $1 / $& / $<name>Substitution and pipeline modesReplace panel
Match exportCopy matches as JSONJSON, JSON Lines, CSV and plain textList and Details panels
AccountNot requiredFree editor, Pro for saved workspacesSign in only to save patterns
Where it runsFully in your browserPatterns are sent to the serverMatching runs in the browser
FAQ

Regex tester FAQ

Which regex flavour is used?

The tester runs JavaScript regular expressions, the same engine browsers use, so patterns behave exactly as they will in your front-end code. PCRE-only syntax such as possessive quantifiers is not supported.

Why does my pattern match nothing?

Most often the global or case-insensitive flag is missing, or the pattern contains an unescaped special character such as a dot or a backslash.

What is the Explain tab for?

It walks the pattern token by token and describes what each piece does, which is the quickest way to understand a pattern you copied from somewhere else.

Can I test a replacement before using it?

Yes. The Replace tab previews the result. Use $1 to $9 for capture groups, $& for the whole match and $<name> for named groups.

What are capture groups?

Parentheses in the pattern create numbered groups. The match list shows each group and the text it captured.

Is my test data uploaded?

No. Matching happens locally in the browser tab.

Is it free?

Yes, with no account required.

All Tools