Skip to content

Step-by-step engine trace · free

Regex Debugger

Watch the regex engine work. The debugger replays the match one step at a time, so you can see where it tries a token, where it fails, and how often it backs up to try again.

What each step means

  • Try: the engine starts a new attempt at a position in the text.
  • Match: a token consumed some text.
  • Fail: a token could not match at the current position.
  • Backtrack: the engine gives back text from a quantifier and tries a shorter or longer choice.
  • Capture: a group recorded what it matched.
  • Found: a complete match was reported.

Use the arrow buttons to move one step at a time, or press play and pick a speed from Slow to Turbo. The counters show the total steps and backtracks, which is the quickest way to compare two versions of the same pattern.

Why the sample backtracks

In the sample, \d+ first grabs all the digits of 8, then px fails because the text says em. The engine backtracks, finds nothing shorter to give back, and moves on. With 120px the first try succeeds. Small traces like this show why greedy quantifiers followed by a fixed suffix are cheap, and why nested ones such as (\d+)+ are not.

Limits

The debugger follows JavaScript semantics, the engine your browser runs. It traces the first 2,000 characters of the test text and stops after 200,000 steps. Hitting that limit is itself a finding: the pattern backtracks catastrophically on this text, and the ReDoS Checker can tell you why.

Frequently asked questions

Is the debugger's result the same as the real engine?
It is built to follow JavaScript's backtracking rules and is checked against the browser's own engine in thousands of automated tests. The matches it reports are the matches the real engine finds.
Can I debug Python or PCRE patterns?
Switch the language and the pattern is converted to JavaScript for the trace. Most patterns behave the same, but engines differ in edge cases, so treat the trace as a guide for other languages.
Is it free?
Yes. There is no account and no limit on use. Everything runs on your own device.

Keep going