Getting Started
RegexLens is an open-source, UI-first developer tool for JavaScript regular expressions (RegExp). It helps you see what matches, why it matches (plain-English steps), how the pattern is structured (AST + railroad diagram), and where it may be risky (smart warnings). Optional sign-in adds cloud-backed features like a saved pattern library, exports, deeper Safety analysis (POST /api/analyze), and Regex Copilot in the Review tab (POST /api/ai/chat), when your deployment enables authentication and the relevant routes.
Where things live
| Surface | URL / path | Purpose |
|---|---|---|
| Marketing site | regexlens.dev (opens in a new tab) (/) | Landing and sign-in entry |
| Workbench | regexlens.dev/app (opens in a new tab) (/app) | Full editor: pattern, test text, matches, tabs |
| Docs (this site) | docs.regexlens.dev (opens in a new tab) — Nextra in docs/; local dev port 3002 | Long-form help |
| Changelog (web) | regexlens.dev/changelog (opens in a new tab) | High-level release notes |
Set NEXT_PUBLIC_SITE_URL and NEXT_PUBLIC_DOCS_URL in production so share links, metadata, and documentation links use your domains (defaults: https://regexlens.dev and https://docs.regexlens.dev).
Anonymous vs signed-in (at a glance)
| Capability | Anonymous | Signed in |
|---|---|---|
| Live matching, flags, templates, fixtures | Yes | Yes |
| Explanations, AST, railroad, warnings | Yes | Yes |
| Shareable URLs | Yes | Yes |
| Saved library, versions, diff | — | Yes |
| Export (Markdown, PR comment, Notion, plain) | — | Yes |
Safety tab + POST /api/analyze | — | Yes * |
Regex Copilot (Review tab) + POST /api/ai/chat | — | Yes * |
* Safety requires a signed-in session. Regex Copilot requires sign-in and your own Anthropic API key (opens in a new tab) (bring-your-own-key via the Review tab; see Regex Copilot).
Signing in is optional for core editing. OAuth (GitHub, Google) and magic links (Resend) are available via Auth.js on the main app when enabled.
Workbench layout
- Pattern (left) — Edit regex, toggle flags (
g,i,m,s,u,y), token toolbar, parse status. - Test text + Matches (center) — Sample input, highlighted matches, capture groups; fixture suite panel when you load a suite.
- Tabs (right) on desktop; segmented control on small screens:
- Explain — Deterministic step-by-step explanation from the AST (not LLM output).
- Safety — Server-side risk score, complexity, extra warnings, and suggestions (
POST /api/analyze; signed in). - Warnings — Fast, client-side heuristics (info / warn / danger).
- Failure — Guidance when the pattern does not match the sample text (when applicable).
- Review — Regex Copilot streaming assistant (signed in; Anthropic key from the tab settings).
- More (overflow) — Structure (AST), Railroad, and Diff (compare against a second pattern).
Header: Docs (opens documentation), Templates, Fixtures, Save / Library, Share, Reset, account menu, and Homepage returns to marketing /.
Sharing & URL state
The editor syncs pattern, flags, and test text into query parameters (p, f, t). Values are typically base64-encoded (with URI-safe handling) so links stay portable. Anyone with the link can load the same state—do not put secrets in pattern or test text if you share URLs.
See Sharing & URLs.
Support the project
If RegexLens saves you time, you can support ongoing work on Buy Me a Coffee (opens in a new tab).