Regex generator
Compose a regex from common presets and refine it against live sample text.
Runs 100% in your browserHow to build a regex
- Pick a preset or start blank. Use a preset for the common cases (email, URL, hex color, US ZIP, etc.) or build from scratch.
- Edit the regex blocks. Type into the pattern field — the matches re-highlight live.
- Toggle flags. Set i, g, m, s, u flags as needed. Copy the final regex.
Build it, don't guess it
The hardest part of regex is not the syntax — it's verifying that the pattern accepts everything you intend and rejects what you do not. This tool runs your regex against live sample text the moment you type, so you can see false positives (matches you didn't expect) and false negatives (inputs that should have matched but didn't) immediately. Start from a preset for the common cases; tweak from there. For full debugging — backreferences, groups, look-ahead — pair this page with snip's regex tester.
Frequently asked questions
- It assembles a JavaScript-flavoured regex from blocks you pick — character classes, quantifiers, anchors, groups — and shows live matches against your sample text. Pick a preset for a head start.
- No — this tool builds regex from explicit, predictable building blocks rather than an LLM. Predictability matters: an LLM-generated regex that "looks right" can quietly mis-validate at scale, where this approach makes every character intentional.
- JS regex is ECMAScript-flavoured. Most of what this tool produces (anchors, classes, groups, quantifiers) works the same in Python re, Go regexp (re2) and PCRE — but backreferences inside lookbehinds and some Unicode property escapes differ. Test in your target runtime.
- No. Both the regex and the test text stay in your browser.