Project
Roulette

Regex Explainer

Paste a regex, get back a sentence a human can read.

IntermediateCommand lineDev tool8–18hAI-buildable 4/5no setupworth shipping

What you're making

You find a horrible regular expression in some old code and have no idea what it does. Paste it in and this reads it back to you in plain English — 'matches an email-ish thing, then optionally a number, then end of line'. It also warns you when a pattern is written in a way that could hang your program on the wrong input.

Parses a regular expression into its component tokens and renders a readable explanation, with warnings for patterns at risk of catastrophic backtracking.

UI
Logic
Useful

Hosting · Free forever

Deploys free on npm, PyPI or GitHub Releases.

Nothing to host. Publishing to a package registry is free and permanent, and anyone can run it with a single command.

Publish to npm — one command and anyone can run it.

Core features · 7

  • Accepts a pattern as an argument or from a pipe
  • Breaks the pattern into tokens and explains each in words
  • Explains groups, quantifiers and lookarounds in plain language
  • Warns about nesting that can cause catastrophic backtracking
  • Shows what a sample input would match
  • Handles named groups and flags
  • Reports a syntax error with the exact position

The interesting part

  • Writing a real tokeniser for regex syntax, which is denser than it looks
  • Explaining nested constructs without producing an unreadable wall of text
  • Detecting backtracking risk without actually running the pattern

Once it works

  • Add a reverse mode that builds a pattern from a description
  • Add a test-string playground
  • Support several regex dialects

Suggested stack

typescriptnodecommander

Track it