See your regex. Debug your regex. Understand your regex.
Regex Railroad turns regular expressions into interactive railroad diagrams, plain English explanations, and a step-through NFA debugger โ all in the browser, with zero server dependencies. Supports JavaScript, Python, and PCRE flavors.
git clone https://github.com/ndcorder/regex-railroad.git
cd regex-railroad
pnpm install
pnpm dev
Open http://localhost:5173 and start typing a regex.
| Feature | JS | Python | PCRE |
|---|---|---|---|
| Named groups | (?<name>) |
(?P<name>) |
(?<name>), (?'name'), (?P<name>) |
| Named backreferences | \k<name> |
(?P=name) |
\k<name>, \k'name', (?P=name) |
| Possessive quantifiers | โ | โ | โ |
| Atomic groups | โ | โ | โ |
| Unicode properties | โ | โ | โ |
| Inline flags | โ | โ | โ |
src/lib/
โโโ parser/ Lexer + recursive descent parser โ AST
โโโ diagram/ AST โ layout โ SVG rendering
โโโ engine/ NFA simulator with step recording
โโโ explain/ AST โ plain English descriptions
โโโ copy/ Regex escaping for 7 target languages
โโโ library/ 22 pre-built regex patterns
โโโ sharing/ URL hash encoding/decoding
โโโ stores.svelte.ts Reactive state (Svelte 5 runes)
pnpm test # 4,896 unit tests (Vitest)
pnpm test:e2e # Playwright end-to-end tests
pnpm check # TypeScript type checking
pnpm lint # ESLint + Prettier
pnpm build # Static site output in build/
pnpm preview # Preview production build
The build produces a fully static site (via @sveltejs/adapter-static) that can be deployed anywhere โ GitHub Pages, Netlify, Vercel, or a plain file server.
Contributions are welcome! See CONTRIBUTING.md for guidelines.