Regex Generator, Pattern Builder & Tester

Build, test, and debug regular expressions with instant capture group inspection, multi-line match breakdown, and common standard templates.

Regex Pattern Builder

Standard Templates
//gm
Active Flags
Expression Evaluation
2 Matches Found
/gm/

Matches

2

Test Lines

4

Flags

gm

Engine

V8 RegExp

Matched Substrings & Capture Groups
Match #1Line 1, Char offset 0
contact@softzar.com
Match #2Line 3, Char offset 35
team.leads+test@sub.domain.co.uk

Zero Server Evaluation Privacy

Regex execution and sensitive test strings are evaluated entirely inside local browser memory.

Chomsky Regular Grammar & Thompson NFA Construction Equations

Regular expressions define type-3 formal languages recognized by finite state automata:

1. Formal Regular Language Inductive Composition
L(R₁ | R₂) = L(R₁) ∪ L(R₂),   L(R₁R₂) = L(R₁)L(R₂),   L(R*) = (L(R))*
2. Thompson NFA State Complexity Bounds
|Q_{NFA}| ≤ 2 × |R|,   |δ_{NFA}| ≤ 4 × |R|
Step-by-Step Finite State Automaton Evaluation
Step 1: Pattern Parsing & Flag Configuration
Compiled regex: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/gm.
Step 2: String Scanning & Sub-Group Extraction
Identified 2 matching occurrences across test stream.
Step 3: Pattern Validation Outcome
Match Status=2 Matches Found

Regular Expression Metacharacter Reference

TokenGrammar DefinitionExample Match
^ / $Start / End of string or line^start / end$
\d / \DDigit [0-9] / Non-digit\d{3} → 123
\w / \WWord char [a-zA-Z0-9_] / Non-word\w+ → identifier_99
(?:...)Non-capturing group(?:https|http)

Frequently Asked Questions

What do the ^ and $ anchors signify in regular expressions?
^ asserts the start of a string or line, while $ asserts the end. Without anchors, a pattern like /cat/ matches 'concatenate'. With anchors (^cat$), it strictly matches the standalone word 'cat'.
What is the difference between greedy and lazy quantifiers?
A greedy quantifier like .* consumes as many characters as possible before backtracking. Adding a question mark (.*?) creates a lazy quantifier that matches the shortest possible span.
What do the g, i, m, and s flags control?
g (global) finds all occurrences rather than halting after the first match; i (ignoreCase) enables case-insensitive matching; m (multiline) treats ^ and $ as matching start/end of each individual line; s (dotAll) allows the dot (.) metacharacter to match newline characters.
Are my test strings uploaded to any remote server?
No. All regex evaluation, capturing group indexing, and match highlighting execute entirely inside your local browser JavaScript engine.

Related Tools