Skip to main content
CodeAlchemy

Long-form guide

Build regex visually, test live, or describe it in plain English

Regex Builder is the regex tool that wants you to never read another regex tutorial. Three modes share one editor: build patterns visually with drag-and-drop blocks, describe what you want in plain English and let the AI generate it, or paste an existing pattern and watch matches highlight live as you tweak the test string.

How to use it

  1. Pick a flavor. JavaScript, PCRE, Python, Ruby, or Go. The flavor selector at the top affects how the AI generates patterns and how flags are displayed. The visual builder always produces JS-compatible patterns, since those translate cleanly to every other flavor.
  2. Build visually. Use the block builder to compose patterns. Drag blocks into order — Anchor, Charset, Group, Repeat, Alternation, Literal — and the assembled pattern updates above. Each block is editable: click a Charset to set its contents, click a Repeat to set min and max, etc.
  3. Or generate with AI. Switch to the AI tab. Type a description like "match an IPv4 address but not localhost" and click Generate. The AI returns a regex, an explanation of what each part means, and three example test cases. You get five AI requests per day — earn ten more by watching a rewarded ad.
  4. Test live. The bottom panel takes a test string and highlights matches in real time. Edit the string or the regex and the highlights update immediately. Hover any match to see its capture groups and start/end indices.
  5. Copy, export, or share. Copy the regex literal (with delimiters) for quick paste. Download the test file to get a generated Jest or Mocha spec with the AI's test cases. Share to generate a permalink that round-trips both the pattern and the test string.

What's behind each mode

The visual builder is purely client-side. Each block compiles to a fragment of regex syntax; the panel concatenates fragments into the final pattern. This is the right mode for "I know what I want, I just want it composable" — like dragging Lego bricks instead of memorizing escape rules.

The AI mode calls Groq first (using a small, fast model) and falls back to a free OpenRouter model when Groq quotas are tight. Your prompt and the resulting regex are never persisted; they're held in memory long enough to render the response and then discarded. We rate-limit by IP plus a fingerprint to make abuse expensive and the free tier sustainable.

The test panel uses your browser's native regex engine for JavaScript flavor and a small WASM-compatible engine for the others, so what you see is exactly what you'll get when you paste the pattern into your code. Capture groups, named groups, lookaheads, and lookbehinds are all supported in the flavors that allow them.

When to reach for it

Most teams don't write regex daily, so they forget the syntax. The builder lets a senior reviewer skim a visual diagram of the pattern instead of decoding (?:[^\s\\]|\\.)*?. The AI mode helps when you know what you want but can't remember whether \b is a word boundary or backspace. The live tester is a sanity check before shipping a pattern that decides whether emails are valid.

A common workflow: describe the pattern in English, let AI generate it, switch to the visual builder to inspect block-by-block, paste a few real test strings into the test panel to confirm matches, then download the test file and commit both regex and tests at once.

Examples

Match a valid email (AI)
Input · prompt
match a valid email address with optional + subaddress
Output · regex
/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/

// Test cases:
// '[email protected]' → match
// '[email protected]' → match
// '[email protected]' → no match
Visual builder: phone number
Input · blocks
Anchor (^)
Literal (+1?)
Charset [0-9]
Repeat {3}
Literal (-)
Charset [0-9]
Repeat {3}
Literal (-)
Charset [0-9]
Repeat {4}
Anchor ($)
Output · regex
/^\+1?[0-9]{3}-[0-9]{3}-[0-9]{4}$/
AI: extract YYYY-MM-DD dates
Input · prompt
find ISO 8601 dates (YYYY-MM-DD) anywhere in a text
Output · regex
/(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/g

// Test cases:
// 'Today is 2026-05-10.' → match: 2026-05-10
// 'Date: 26-05-10.' → no match

Frequently asked questions

The visual builder and live test panel are completely free. AI generation is rate-limited to 5 requests per IP per day to keep the service free for everyone — earn extra requests with the rewarded button if you need more.