Regex Tester
Test JavaScript regular expressions against sample text, inspect matches and capture groups, preview replacements, and explore common syntax.
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–23
ops@example.com$1: ops - #2 · characters 27–44
sales@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
- Type the pattern into the expression field, or paste a literal such as /foo/gi - the optional slashes and flags are detected for you.
- Toggle the g / i / m / s / u / y flag chips. The active flags are shown next to the pattern.
- Paste the text to test in the Match tab; matches highlight live and the counter shows how many were found.
- Step through matches with the arrows and click one to focus it. The details list shows the range, capture groups and named groups.
- Switch to Replace to preview a substitution using $1 for groups, $& for the whole match or $<name> for named groups.
- 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.
- 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-14Match: 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.com2 matches: ops@example.com, sales@example.com
Replace with a group
Pattern: (\d{4})-(\d{2})-(\d{2})
Replacement: $3/$2/$12025-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 stringRegex tester vs regex101 and RegExr
| Dimension | This tester | regex101 | RegExr |
|---|---|---|---|
| Regex engine | JavaScript / ECMAScript | PCRE2, JavaScript, Python, Go, Java, .NET, Rust, POSIX | JavaScript and PHP/PCRE |
| Live highlight | Yes, while you type | Yes | Yes, real time |
| Explanation | Token by token, indented by group | Token by token plus a step debugger | Tooltips through the reference |
| Quick reference | Click a token to insert it | Click a token to insert it | Click a token to insert it |
| Replace preview | Built in, with $1 / $& / $<name> | Substitution and pipeline modes | Replace panel |
| Match export | Copy matches as JSON | JSON, JSON Lines, CSV and plain text | List and Details panels |
| Account | Not required | Free editor, Pro for saved workspaces | Sign in only to save patterns |
| Where it runs | Fully in your browser | Patterns are sent to the server | Matching runs in the browser |
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.