Regex Debugger: see inside your regex
See exactly where your pattern matches, fails, or backtracks. Explore its execution graph, inspect captured values, and watch assertions check the input without consuming it.
Zoom from the whole match into one operation. Every selection connects the graph, pattern, and input.
- Free
- Included: 50-event preview (PCRE2)
- Pro
- Longer traces, captures, and operation details (PCRE2)
- Self-hosted
- Advanced regex bundle
Open the debugger
- Select PCRE2 (PHP).
- Enter a valid pattern and the input you want to inspect.
- Open Regex Debugger from the tools menu.
In Unit Tests mode, open a test row's actions menu (⋮). Select Debug Test.
Read the colors and hotspots
The Pattern row is a heat map of recorded activity. Green means less activity; amber and red mean more. Use Hotspots: Low → High to find parts that the engine revisits. This scale shows activity, not elapsed time.
In the Graph, colors describe execution: green is Match, red is Failure, amber is Backtrack, and blue is Progress. Diagonal stripes mark Assertion checks.
The Input legend explains the text highlights: consumed text, text checked by an assertion, and text given back during backtracking. A solid marker shows the next input position; a dotted marker shows a separate assertion position.
Explore nested groups
Open this recursive pattern to inspect nested parentheses:
- Open Regex Debugger, then select Zoom in to expand part of the trace.
- Drag the graph to pan. Use the right-hand scrollbar to move through deeper groups.
- Switch graph labels from Pattern to Input to see the text each block covers.
- Select a group or attempt. Inspect its result, input range, event range, and capture snapshot in the sidebar.
Inspect backtracking
Use this pattern with no flags:
^(?<key>.+)=(?<value>[0-9]+)$
Input:
timeout=120
- Open Regex Debugger and select the first
.+operation. - Select Next regex operation in the Operation controls.
- Continue until Match found appears.
The greedy .+ consumes all 11 characters, so = fails. Follow the Given back highlights as backtracking returns characters until = matches the separator.
At the successful result, Captures shows key: timeout and value: 120.
Find a failing assertion
The lookahead requires a .com domain. Enable multiline (m) to check each line:
^(?<user>[a-z]+)@(?=[a-z]+[.]com$)(?<domain>[a-z]+[.][a-z]+)$
ada@example.org
ada@example.com
- Open Regex Debugger and select Next failure.
- Advance through the operations. Inside the lookahead,
creports Did not match at theoin.org. - Select Next match to jump to the successful attempt.
- Select the attempt's top row. Match found appears with
user: adaanddomain: example.comin Captures.
During the first attempt's lookahead, Next input position stays at 4. Assertion position moves forward as the engine checks the domain. The dotted marker follows that check without consuming input.
Move through the trace
The graph shows match attempts from left to right, with nested groups underneath. Each attempt tries the pattern at an input position.
A trace records pattern checks, group transitions, backtracking, and results. A graph block can cover several events. Each attempt shows its recorded event count.
Click a block to select it. Click it again to clear the selection.
Mod means Cmd on Mac and Ctrl on Windows or Linux.
| Control | Shortcut | Action |
|---|---|---|
| Graph inspection | Left / Right | Select a block at the same depth within the current attempt. |
| Graph inspection | Up / Down | Select the parent / first child. |
| Event | Mod+Left / Mod+Right | Follow execution, including group results. |
| Operation | Shift+Left / Shift+Right | Move between operations without stopping at enclosing group results. |
| Match | — | Move to the first operation in the previous or next successful attempt. |
| Failure | — | Move to the first operation in the previous or next failed attempt. |
Use Event to visit each group result after its operations. Operation avoids these extra stops in nested assertions and recursive patterns. Both stop at each attempt result before continuing to another attempt.
After you click a group or attempt, the next Event or Operation button enters its first operation.
Navigation buttons focus the graph so you can continue with the keyboard. Hold Mod to show shortcuts on the Event and Operation buttons. Select Shortcuts to open shortcut help.
Read the input and captures
The sidebar shows the input positions and highlights for the selected block. Highlights distinguish consumed text, assertion checks, and text given back during backtracking.
Captures and Operation details show captured values, the attempt, the event range, and marks.
Inside assertions, the main cursor stays at the outermost assertion's starting position. A dotted marker shows the assertion's position when it differs from the main cursor.
Adjust the view
Use Zoom in, Zoom out, the mouse wheel, or the overview handles to zoom. The zoom buttons keep the selected block in view. Drag the graph to pan. Reset zoom restores the full trace width and returns to the top.
Pattern and Input switch the text shown on graph blocks.
Recording limits
Preview limit reached and Incomplete trace mean recording stopped before execution finished. When Record more appears, select it to double the event limit, up to 1,000,000 events. Execution stops after 30 seconds.
Trace length does not measure production performance.