Regex Generator
AI-poweredDescribe what you want to match in plain English. Get a regex pattern with a live test panel and a token-by-token breakdown.
01 — Overview
How the Regex Generator works
AI-powered natural language to regex. Generates a pattern with flags, explains each token, and lets you test against sample text with live highlighting. Built for the moments when you need a regex now and don't want to remember whether \d needs escaping.
02 — Use cases
When to use the Regex Generator
- 01
Match all email addresses in a paragraph
- 02
Extract URLs from a log file
- 03
Validate UK postcodes or US ZIP codes
- 04
Find anything that looks like a phone number
- 05
Pull out semantic version strings like v1.2.3
03 — Examples
Regex Generator examples
match all email addresses except gmail
ex 01\b[A-Za-z0-9._%+-]+@(?!gmail\.com)[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b
Matches valid email syntax but uses a negative lookahead to exclude gmail.com.
find UK postcodes
ex 02\b[A-Z]{1,2}\d[A-Z\d]?\s?\d[A-Z]{2}\b
Matches the standard UK postcode format.
match a hex color, with or without #
ex 03#?[0-9a-fA-F]{6}\b
Matches 6-character hex codes with an optional leading #.
extract IPv4 addresses
ex 04\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b
Matches valid IPv4 addresses with bounded octets (0-255).
04 — FAQ
Regex — frequently asked questions
Which flavor of regex does this generate?
How do I use the generated regex in JavaScript?
What do the flags mean?
Why does the explanation not match the regex exactly?
Can I use this for password validation?
Does the test panel save my pasted text?
05 — Reference
Specs and further reading
The primary sources this tool follows. Where behaviour is defined by a specification, we link the specification rather than a summary of it.
- Regular expressions guide
MDN Web Docs — Reference for JavaScript regex syntax, flags, groups, and lookaround.
- RegExp objects
TC39 — The ECMAScript specification text that defines how JavaScript engines evaluate patterns.
- PCRE2 pattern syntax
PCRE — Syntax summary for the PCRE flavour used by PHP, nginx, and many command-line tools.
06 — Compare
How this compares to regex101
regex101 is a debugger: real-time highlighting, step-by-step explanation, unit tests, and nine regex flavours. If you're testing or fixing a pattern, use it — nothing here competes. The generate.now regex tool does the opposite job, drafting a pattern from a plain-English description. Draft here, then debug there.
Read the full comparison→07 — More
Tools that pair with Regex
Slug Generator
Convert a title into a URL-safe slug. Separator, case, max-length, and Unicode transliteration options.
Cron Expression Generator
Turn plain English into cron expressions. Or paste a cron expression and get a human-readable explanation.
JSON to TypeScript Types
Paste JSON, get TypeScript interfaces, type aliases, Zod schemas, or Valibot schemas. Updates as you type.