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
| Token | Grammar Definition | Example Match |
|---|---|---|
| ^ / $ | Start / End of string or line | ^start / end$ |
| \d / \D | Digit [0-9] / Non-digit | \d{3} → 123 |
| \w / \W | Word char [a-zA-Z0-9_] / Non-word | \w+ → identifier_99 |
| (?:...) | Non-capturing group | (?:https|http) |