Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
The code for iHateregex.io - The Regex Cheat Sheet
iHateRegex is an open-source regex cheatsheet and playground that turns any regular expression into an interactive railroad diagram with plain-English explanations, live match highlighting, and exportable graphics.
iHateRegex is the codebase behind the site iHateregex.io, a visual cheat sheet for regular expressions. It accepts a regex string and flags as input and produces a railroad diagram rendered in the browser, a hoverable breakdown of each part, and a test area that highlights matching lines from sample text. The project is maintained by geongeorge and the community, and the current v2 is written in TypeScript, TanStack Start, and PostgreSQL. The original Nuxt.js version remains on the v1 branch.
The repository is a pnpm monorepo with two packages: a TanStack Start web application that includes PostgreSQL migrations, and a browser-only TypeScript package called regex-railroad-diagram that renders the diagrams. After you enter a regex, the renderer runs locally in the browser using the regexper algorithm, and the test strings are matched against the expression live with the given flags. Saving and publishing requires a user account; private saves are stored with an opaque ID, not a query-string version of the regex.
Yes, iHateRegex is open source and free to use at iHateregex.io. You can also self-host it by cloning the repository and following the setup steps for Node.js, pnpm, and PostgreSQL.
Yes, the diagram for any regex can be exported as SVG or PNG. This is available both for the community cheat sheet entries and your own playground expressions.
Follow the guide in the README: add your expression to apps/web/src/content/regexes.json with fields such as id, title, tagline, description, regex, flag, matchText, and tags, then create a markdown file explaining the expression. Open a pull request.
v1 was built on Nuxt.js and remains on the v1 branch. v2 is a ground-up rewrite using TypeScript, TanStack Start, and PostgreSQL, with a new monorepo layout and browser-only diagram rendering.
Sign in to the playground, create and save a regex, then click publish. The site creates a public community page at /community/:id; you can unpublish at any time.
