Regex Tester & Debugger

Real-time Regular Expression tester, evaluator, and debugger. Highlight matches instantly, inspect capture groups, and test string replacements with full PCRE/JS support.

Pattern Configuration

//g
Modifiers / Flags
Common Pattern Library
Regex Evaluation
2matches found
Syntax Valid

Matches

2

Active Flags

g

Target Chars

99

Status

Matched

Live Highlighted MatchesAmber mark highlights
Contact support@softools.com or sales.desk@company.co.uk for inquiries. Invalid email: user@domain.
Replacement Result
Contact [REDACTED_EMAIL] or [REDACTED_EMAIL] for inquiries. Invalid email: user@domain.
Match Details & Index Offsets
#1support@softools.com
Index: 8
#2sales.desk@company.co.uk
Index: 32

ReDoS Protection Advisory

Avoid nested unbounded quantifiers like (a+)+ which cause catastrophic backtracking ($O(2^n)$ runtime) and lead to server denial-of-service vulnerabilities.

Theoretical Automata & Regular Language Mathematics

Regular expressions correspond to Chomsky Type-3 Formal Grammars, evaluated via Non-Deterministic Finite Automata (NFA) converted to Deterministic Finite Automata (DFA) in $O(N)$ string matching complexity.

1. Kleene Star (*) & Plus (+) Algebraic Closures
L(R*)=⋃_i=0^∞ L(R)^i
and
L(R⁺)=⋃_i=1^∞ L(R)^i
2. Finite State Transition Invariant
δ(q, c) ⊆ Qwhereq ∈ States, c ∈ Alphabet Σ
Step-by-Step Pattern Dissection (Email Validation)
Step 1: Local Part Validation
[a-zA-Z0-9._%+-]+: Matches 1 or more alphanumeric characters, dots, pluses, or hyphens before the '@'.
Step 2: Domain Host & Top-Level Domain (TLD)
@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}: Matches domain hostname followed by an escaped dot and a TLD of minimum length 2.
Step 3: Engine Execution & Capture Offsets
Match Status=Global match identified at indices [8, 30] and [34, 58]

Essential Metacharacters & Quantifiers Reference

TokenCategoryFunction / MeaningExample Match
.WildcardAny single character except newlinec.t → cat, cot, c9t
\d / \DCharacter ClassDigit [0-9] / Non-digit\d{3} → 123
\w / \WCharacter ClassWord character [a-zA-Z0-9_] / Non-word\w+ → user_name
^ / $AnchorStart of string/line / End of string/line^Start.*End$
(?:...)GroupingNon-capturing group (optimizes memory)(?:https|http)

Frequently Asked Questions

What is a Regular Expression (RegEx)?
A regular expression is a specialized formal syntax of characters defining a search pattern. It is implemented across standard programming languages (JavaScript, Python, Go, Rust, Java) for string validation, extraction, parsing, and text replacement.
What is the difference between greedy and non-greedy (lazy) quantifiers?
Greedy quantifiers (`*`, `+`, `{n,}`) match as many characters as possible. Adding a question mark (`*?`, `+?`) makes them lazy, causing them to match the shortest possible character sequence that satisfies the pattern.
How do capture groups and backreferences work in replacements?
Wrapping subpatterns in parentheses `(...)` captures that substring into numerical registers ($1, $2, etc.). In regex replace operations, `$1` outputs the exact text captured by the first group.
What does the 'g' (global) flag do?
Without the `g` flag, a regular expression executes only once and stops after discovering the first match. With the `g` flag enabled, the regex engine advances its internal cursor (`lastIndex`) across the entire string to identify all occurrences.

Related Tools