Code & Scripts
Regex without the headache.
Describe the pattern you want to match, or paste a regex and ask what it does. Works for JavaScript, Python, PCRE, .NET, Go, and Java. Free to try.
Used by 99,000+ developers, analysts, and admins
Try it
Free to try. No credit card. 5 generations on us.
What you'll get
A real output for a real prompt.
Regex Generator
Describe the pattern or text you need help with
Need inspiration? Try one of these prompts:
Action
Results
Nobody writes regex from memory. Anyone who tells you they do is either lying or hasn't tried to match an email address recently.
The real workflow is: have a vague idea of what you want to match, Google “regex for X,” copy something from Stack Overflow, find out it doesn't quite work for your case, and spend 45 minutes tweaking it while slowly losing your mind.
This tool replaces that loop. Describe the pattern in plain English. Get a regex that works, for the flavor you're using, with each piece of the pattern explained.
Two directions
You can go the other way too. Paste a regex you found somewhere, and ask what it matches. Useful when you inherit code, or when you're reviewing a PR and the reviewer wrote something clever that you're 70% sure is correct.
Regex flavors
Different languages use different regex engines. Most of the overlap is fine, but the edge cases matter. We support JavaScript (ECMAScript), Python (re module, plus regex for the expanded Unicode stuff), PCRE (PHP, Apache, and most “just regex” tools), .NET, Go's RE2, and Java's java.util.regex.
Pick the flavor in the toggle. The generated pattern uses syntax that actually works in that engine. Lookbehind in JavaScript, for example, only works in modern engines. We'll flag it.
Common asks we see
Email validation (the real one, not the 10-line monster from Stack Overflow). URL matching. Phone numbers with and without country codes. Date formats. Extracting text between delimiters. Password validation with specific rules (at least one uppercase, one number, etc.). Log line parsing.
One honest warning about email regex
There is no regex that perfectly validates every possible valid email address. The official spec allows things like comments and quoted strings inside local parts that nobody actually uses. What you want is a regex that catches the 99.9% of real emails and rejects obvious garbage. That's what we'll give you.
Common questions.
Guides & tutorials.
In-depth Regex Generator walkthroughs from our library — the how and the why behind what this tool generates.
Pattern Building Blocks
- Literal Characters: Regular Expressions REGEX Explained
- Escaped Characters: Regular Expressions REGEX Explained
- Character Classes: Regular Expressions REGEX Explained
- Metacharacters: Regular Expressions REGEX Explained
- Anchors: Regular Expressions REGEX Explained
- Boundaries: Regular Expressions REGEX Explained
Quantifiers & Matching Behavior
Groups & Lookarounds
Search & Replace Operations
Flavors & Engines
- Regular Expressions REGEX Explained
- Regex Engines: Regular Expressions REGEX Explained
- JavaScript Regular Expressions: Regular Expressions REGEX Explained
- Python Regular Expressions: Regular Expressions REGEX Explained
- Perl-Compatible Regular Expressions: Regular Expressions REGEX Explained
- POSIX: Regular Expressions REGEX Explained
Validating User Input
- The Ultimate Guide to Regex for Email Validation
- The Ultimate Guide to Regex for Email Addresses
- The Ultimate Guide to Regex for Password Validation
- The Ultimate Guide to Using Regex for Phone Numbers
- The Ultimate Guide to Using Regex for Postal Codes
- The Ultimate Guide to Using Regex for Credit Card Numbers
+1 more guides
Matching Web & Data Formats
- The Ultimate Guide to Using Regex for URLs
- The Best Regex for Matching HTTP or HTTPS URLs
- A Comprehensive Guide to Using Regex for HTML Tags
- A Comprehensive Guide to Using Regex for IP Addresses
- Regex for Specific File Extensions (e.g., .pdf or .jpg)
- A Comprehensive Guide to Using Regex for Dates (MM/DD/YYYY)
+1 more guides