Step-by-Step Regex Visualizer
Master Regular Expressions in Real-Time
How the Execution Engine Works
RegExLab compiles your pattern into a directed acyclic graph of atomic nodes, rendering each match attempt as a live traversal path. Watch how the engine consumes characters, branches on alternations, and recursively dives into quantifiers without losing context.
When a match fails, the visualizer highlights the exact backtrack edge in crimson, showing precisely which quantifier or group triggered the rewind. This granular trace eliminates guesswork when debugging catastrophic backtracking in patterns like `(a+)+b` against long non-matching strings. The engine logs step counts, memory allocations, and CPU cycles per node, giving developers concrete metrics to optimize their regular expressions before deploying to production.
Real-World Match Scenarios
Email Validation with Nested Groups
Trace how `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$` evaluates local parts, handles consecutive dots, and verifies TLD length. The graph reveals why unanchored patterns often yield false positives in log parsing.
Log Timestamp Extraction
Visualize the step-by-step capture of `(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})\.\d{3}Z` against ISO 8601 strings. See how non-greedy quantifiers prevent over-matching when multiple timestamps appear on a single line.
Catastrophic Backtracking Demo
Run `(a+)+b` against `aaaaaaaaaaaaaaaaaaaaac` and watch the visualizer map the exponential state explosion. The engine caps at 10,000 steps and freezes the graph, highlighting the overlapping quantifier that caused the deadlock.
Ready to Decode Your Patterns?
Stop guessing why your regex hangs. Load your production patterns into the visualizer, watch the execution graph render in real time, and ship faster, safer code.
Open Visualizer View API Reference