M ToolsMio

Regex Tester — Test & Debug Regular Expressions Online

Test and debug regular expressions with real-time match highlighting, capture groups, replace mode, pattern explanation and a built-in library. 100% browser-based, free.

/
/
Mode:
Regex TesterTest & Debug Regular Expressions Online

Test and debug regular expressions with real-time match highlighting, capture groups, replace mode, pattern explanation and a built-in library. 100% browser-based, free.
8 matches
#1 · Index 0 · Length 5
Regex
#2 · Index 6 · Length 6
Tester
#3 · Index 15 · Length 4
Test
#4 · Index 22 · Length 5
Debug
#5 · Index 28 · Length 7
Regular
#6 · Index 36 · Length 11
Expressions
#7 · Index 48 · Length 6
Online
#8 · Index 56 · Length 4
Test

Character Classes

.Any character except newline
\dDigit [0-9]
\DNon-digit
\wWord char [A-Za-z0-9_]
\WNon-word char
\sWhitespace
\SNon-whitespace
[abc]a, b, or c
[^abc]Not a, b, or c
[a-z]Range a to z

Anchors

^Start of string/line
$End of string/line
\bWord boundary
\BNon word boundary

Quantifiers

*0 or more
+1 or more
?0 or 1 (also makes lazy)
{n}Exactly n
{n,}n or more
{n,m}Between n and m
*?Lazy 0 or more

Groups & References

(abc)Capture group
(?:abc)Non-capturing group
(?<name>abc)Named group
\1Backreference to group 1
a|bAlternation: a or b

Lookarounds

(?=abc)Positive lookahead
(?!abc)Negative lookahead
(?<=abc)Positive lookbehind
(?<!abc)Negative lookbehind

Flags

gGlobal — all matches
iCase insensitive
mMultiline
sDotall (. matches newline)
uUnicode
ySticky
dHas indices

Features

Real-time Match Highlighting

See matches highlighted in your test string as you type the pattern. Capture groups are color-coded so you can spot exactly what each part of your regex captures.

Pattern Explanation Panel

Every part of your pattern is broken down into plain English: anchors, character classes, quantifiers, groups, lookarounds — so you understand why it matches (or does not).

Regional Pattern Library

One-click load for 16+ common patterns including email, URL, IPv4, UUID, hex color, US ZIP / SSN / credit card and slug. Switch to the Chinese library for mobile phone, ID card, postal code patterns.

Match & Replace Modes

Toggle between match mode (see all matches and capture groups) and replace mode (preview the replacement output in real time with $1, $2 backreferences).

Built-in Cheatsheet

Collapsible quick reference for character classes, anchors, quantifiers, groups, lookarounds and flags — never leave the page to look up syntax.

100% Browser-Based

Patterns and test strings are processed entirely in your browser via native JavaScript RegExp. Nothing is uploaded to any server. Your data stays private.

How to use the Regex Tester

  1. Type or paste your regular expression in the Pattern input, e.g. \d{4}-\d{2}-\d{2}
  2. Toggle the flags you need: g (global), i (case-insensitive), m (multiline), s (dotall), u (Unicode), y (sticky), d (indices)
  3. Paste your test string in the Test String area — matches highlight in real time
  4. Browse the Matches panel to see each match's position, length and capture groups
  5. Switch to Replace mode and enter a replacement string (use $1, $2 for capture groups) to preview the rewrite

Common Use Cases

Validating email and phone inputs

Build and test patterns for form validation before pasting them into your code. Confirm edge cases like + in email locals or country-specific phone formats actually match.

Debugging existing patterns

Copy a regex from production that "stopped working" and run it against the failing input. The Explanation panel often reveals an unintended . that matches more than expected.

Bulk find-and-replace

Use Replace mode to clean up messy text: collapse multiple spaces, swap date formats, rewrite URLs, or extract fields. Copy the result back into your editor.

Learning regex

New to regex? Load a pattern from the Library, study the Explanation panel, then tweak the pattern and watch how matches change. The Cheatsheet covers all the syntax in one panel.

Code review prep

Before approving a PR that adds a regex, paste it here and verify it handles the edge cases the author claims. Catastrophic-backtracking patterns become obvious.

Log parsing

Test patterns for extracting timestamps, status codes or trace IDs from a sample log line before deploying the pattern in your log pipeline or grep workflow.

Pro Tips

Frequently Asked Questions

What is a regex tester?
A regex tester lets you write a regular expression, run it against a sample string, and immediately see which parts match. It highlights matches, lists capture groups, and (in our tool) explains what each part of the pattern means in plain English — useful for both learning and debugging.
Which regex flavor does this tool support?
This tool uses your browser's native JavaScript RegExp engine, which is ECMAScript 2018+ compliant. It supports all standard features: capture groups, named groups (?<name>...), lookahead (?=...), lookbehind (?<=...), Unicode property escapes \p{...} with the u flag, and the d flag for match indices. PCRE-only features like (?>...) atomic groups are not supported.
How do I use capture groups and named groups?
Wrap part of your pattern in parentheses to create a numbered capture group: (\d{4})-(\d{2})-(\d{2}) creates three groups. For named groups, use (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}). The Matches panel shows each group with its index, name and captured text.
What is the difference between match mode and replace mode?
Match mode shows every place in the test string where your pattern matches, with capture groups. Replace mode takes a replacement string (supporting $1, $2, $<name> backreferences) and shows the rewritten output. Use match for inspection, replace for transforming text.
How do I avoid catastrophic backtracking?
Patterns like (a+)+ on a long string can hang the browser due to exponential backtracking. The tool caps test strings at 50KB and matches at 1000 to protect you, but the real fix is writing patterns without nested quantifiers — use atomic-like constructs such as (?:[^"]*) instead of (.*) when matching content between delimiters.
Is my regex sent to any server?
No. Patterns, test strings, and replacement strings are processed entirely in your browser using the native JavaScript RegExp API. Nothing leaves your device. You can verify this by opening DevTools → Network and watching: there are zero requests when you type.

More Tools