Regex Tester & Debugger Online

Free online Regex Tester and Debugger. Test RegExp patterns with instant match highlighting, capture group analysis, flag controls (g, i, m, s, u), and cheat sheet presets.

Valid Pattern · 2 matches
//g
Flags:
Insert:
Popular Regex Patterns:
Test String (Input)
1 line · 92 chars
Live Matches Highlight
2 matches
Contact [email protected] or [email protected] for questions. Invalid: [email protected]
Match Breakdown & Capture Groups (2)Click any match to inspect group segments
#1
Index: 8–28 · Length: 20 chars
$1: "support"$2: "usefulgo.com"
#2
Index: 32–58 · Length: 26 chars
$1: "john.doe123"$2: "enterprise.org"

Developer Scenario: Extracting Username and Domain from an Email Header

A developer needs to parse incoming email sender addresses like `[email protected]` and extract both the local user and domain segments.

Regex Pattern([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})
Flagsg (Global Match)
Captured Group 1 (User)"contact"
Captured Group 2 (Domain)"support.usefulgo.com"

💡 Capture groups segment complex matched strings cleanly, allowing effortless extraction into backend variables or database columns.

How to use Regex Tester & Debugger Online

  1. 1

    Enter your regular expression pattern between the slashes (/ ... /) and toggle desired flags (g: global, i: ignore case, m: multiline, s: dotAll, u: unicode).

  2. 2

    Type or paste your test text into the test area to see matched strings highlighted in real time.

  3. 3

    Inspect match details below the editor for exact indices, length, and numbered capture groups, or switch to the Replace tab to test string substitution.

Why use this tool?

Live Real-Time Pattern Evaluation

Watch matches highlight instantly as you type every token or quantifier, complete with helpful error callouts for unmatched brackets or malformed quantifiers.

Capture Group Breakdown and Details

Inspect the full match value along with individual numbered and named capture groups, exact start/end character offsets, and total match counters.

Built-in Cheat Sheet and Common Pattern Presets

Quickly load vetted regex patterns for emails, URLs, IPv4/IPv6 addresses, phone numbers, UUIDs, dates, and alphanumeric slugs with one click.

Continue your workflow

Working with scheduled automation and regex log filters? Check out the Translate crontab schedules to English.

Need to structure extracted regex data into JSON? Use the Format and validate JSON payloads.

Comparing before-and-after string substitutions? Try the Compare text and regex outputs.

Validating and parsing URL query components? Use the Encode URL and URI strings.

Essential Regex Metacharacters and Quantifiers Cheat Sheet

Quick reference guide for commonly used regular expression characters and symbols.

TokenNameDescription / MeaningExample
^CaretMatches beginning of string (or line in multiline mode)^Hello
$DollarMatches end of string (or line in multiline mode)world$
.Dot / WildcardMatches any single character except newlinea.c matches "abc"
*StarMatches 0 or more occurrences of preceding itemab* matches "a", "ab", "abb"
+PlusMatches 1 or more occurrences of preceding itemab+ matches "ab", "abb"
?Question MarkMatches 0 or 1 occurrence (optional)colou?r matches "color" or "colour"
\dDigitMatches any ASCII numeral equivalent to [0-9]\d{4} matches "2026"
\wWord CharacterMatches alphanumeric characters and underscore [a-zA-Z0-9_]\w+
\sWhitespaceMatches space, tab, newline, or form feed\s+

Special metacharacters like . * + ? ^ $ ( ) [ ] { } | \ must be escaped with a backslash (\) when matching literally.

Frequently asked questions

What does the "g" (global) flag do in regex?

Without the "g" flag, a regular expression stops after discovering the first match. The "g" flag instructs the regex engine to continue scanning the entire input text and find all matches.

What is the difference between non-capturing groups (?:...) and capture groups (...) ?

Capture groups (...) store matched substrings in memory so they can be referenced as $1, $2 or in match arrays. Non-capturing groups (?:...) apply quantifiers or alternation without storing the result, improving matching performance.

What does the "s" (dotAll) flag do?

By default, the dot (.) wildcard matches any character except line break terminators (\n, \r). Enabling the "s" flag allows the dot to match newline characters as well.

Are regex patterns tested locally in my browser?

Yes. All pattern compilation, matching, and replacement execute directly in your browser using standard JavaScript ECMAScript RegExp mechanics.

Related tools

Developer Tools