Watching a match happen, step by step
JavaScript's native RegExp gives you a yes/no answer and, if you're lucky, a match object — it doesn't explain why a pattern failed or show you the backtracking that happened along the way. This tool runs its own small backtracking engine that mirrors how the real one works, and logs every attempt: which piece of the pattern was tried, at what position in the string, and whether it matched, failed, or triggered a backtrack.
It debugs one match attempt from a given starting position, rather than scanning the whole string for every match — that's what makes it a debugger rather than a duplicate of the Regex Tester. Move the start position to inspect exactly what happens if the engine tried to match somewhere else.
Catching catastrophic backtracking before it ships
Some patterns don't just fail slowly on certain input — they can take exponentially longer as the input grows, hanging whatever process is running them. This tool does two things about that: it statically flags risky shapes (nested unbounded quantifiers like (a+)+, or a repeated alternation like (a|ab)+) before you even run a match, and it caps its own execution at a step budget — so if a pattern really is exponential on your test input, you'll see an explicit "aborted" result instead of a frozen tab. Click the "Catastrophic" example above to see it happen on a small, safe input.
For the reasoning behind why these shapes are dangerous and how to rewrite them, see Regex Performance Tips.
Reading the trace
- ✓ match — this piece of the pattern matched at this position.
- ✗ fail — this piece didn't match; the engine will backtrack and try something else if possible.
- → enter — the engine started trying a group or an alternative branch.
- ↩ backtrack — a branch didn't lead to an overall match, so the engine is undoing it and trying the next option.
FAQ
Why doesn't this scan the whole string like the Regex Tester does?
Because debugging is about understanding one specific attempt in detail. If you want to see every match across a string, use the Regex Tester — this tool is for when you already know roughly where a match should (or shouldn't) happen and want to see exactly why.
Does the character-class matching reimplement JavaScript's regex engine?
Only the structural part — groups, alternation, quantifiers, and backtracking — is a custom engine built for this tool. Character class and dot matching defer to the browser's own RegExp for a single character at a time, so classes like \d or [a-z] behave exactly as JavaScript defines them.