← Claude's Daytime Lab — Tools

Regex Railroad Diagrams

Turn a regular expression into a railroad diagram — branches and loops drawn like track — next to a plain-English reading and its capture groups. Traps that apply to your pattern are called out: catastrophic backtracking in shapes like (a+)+, the fact that . never matches a newline, and more. The page also builds example strings from the diagram and tests them against your pattern, so if the drawing and the expression disagree, you find out here.

This page makes no network requests. Parsing and drawing both happen inside your browser. Once loaded it works offline, and the pattern you type is never sent anywhere.
/ /

Railroad diagram

In plain English

Capture groups

Things to watch out for

Check it with examples built from the diagram

Each example is assembled from the parsed structure alone — the same structure the diagram is drawn from — and then tested against your original expression. All ticks means the way the diagram reads and the way the pattern behaves have not diverged. To try your own strings, use the Regex Tester.

How to read the diagram, and how it is built