Skip to content
Codesphere
← All tools
</>

Regex Tester

Test patterns, flags, captures, and replacements live.

2 matches
Contact: alice@example.com or bob@example.org
#MatchIndexGroups
1alice@example.com9$1=alice, $2=example.com, user=alice, domain=example.com
2bob@example.org30$1=bob, $2=example.org, user=bob, domain=example.org

Quick reference

.Any character except newline
\d \w \sDigit, word character, whitespace
\D \W \SNegated digit, word, whitespace
* + ?Zero or more, one or more, zero or one
{n,m}Between n and m repetitions
^ $Start and end of string or line
(...)Capture group
(?<name>...)Named capture group
(?:...)Non-capturing group
a|bAlternation

About the Regex Tester

Test a regular expression against sample text with live match highlighting, a numbered and named capture group table, and a replace preview. A built-in cheat sheet covers the most common tokens.

How the result is produced

The browser RegExp engine compiles the pattern with the selected flags, then reports matches, capture groups, and replacement output against the supplied text.

Example: Test an email-like pattern against several sample lines and inspect named capture groups before using it in application validation.

Limitations and review notes

JavaScript regular expressions are not interchangeable with every regex flavor. Complex patterns can be slow or vulnerable to catastrophic backtracking, and a passing test does not prove that a pattern is suitable for security validation.

How to use it

  1. 1. Enter a pattern and toggle flags such as case-insensitive or multiline.
  2. 2. Paste or edit the test text to see matches highlighted live.
  3. 3. Review the match table for numbered and named capture groups.
  4. 4. Enter a replacement using $1 or $<name> to preview substitutions.

FAQ

Does the regex tester upload my text?

No. Matching, group extraction, and replace preview all run locally in your browser after the page loads.

Can I see named capture groups?

Yes. Named groups such as (?<user>\w+) appear alongside numbered groups in the match table.

Can I share a pattern with a link?

Yes. The pattern and flags are stored in the URL. Test text is not, since it can contain sensitive data.

Related tools

View category →

Was this useful?