How it works
- Describe what you want to match in plain English, and say whether you are checking a whole field or finding matches inside text.
- Pick the language or tool you will use it in (JavaScript, Python, Google Sheets and more), paste a few examples if you have them, and click Write my regex.
- Get the pattern, a line-by-line explanation, strings that match and don't, and a one-line snippet. Test it on your real data before you ship it.
Examples
Sample results for the inputs shown, so you can see the format and quality before you try it.
What should the regex match? US phone numbers like (555) 123-4567, 555-123-4567 or 555.123.4567. Validate a form field.
Where will you use it? JavaScript
What should the regex match? Pull every order ID out of a log line. Order IDs look like ORD- followed by 8 digits.
Where will you use it? Python
Examples that should and should not match: Match: ORD-00482913 No match: ORD-123, XORD-00482913
What should the regex match? Check whether a cell contains a valid-looking email address
Where will you use it? Google Sheets (REGEXMATCH)
Tips for better results
- Paste real examples of both kinds. "Should match: ORD-00482913. Should not: ORD-123" removes most of the guessing.
- Say whether you are validating a form field or searching a document. The first needs ^ and $; the second needs word boundaries instead.
- Pick the right flavor. Google Sheets and Go do not support lookaheads or backreferences, so a pattern copied from a JavaScript answer can fail there.
- Run the pattern against a sample of your real data in regex101 or your test suite before shipping. The examples on this page are worked by hand, not executed.
FAQ
Is this regex generator free?
Yes. Enter your email once to use it (you'll also get Something Big, our free weekly AI newsletter, and you can unsubscribe anytime). There's no account and no credit card.
Which regex flavors does it support?
JavaScript, Python, PCRE (PHP and grep -P), Java, C# and .NET, Go and Google Sheets (both RE2), and POSIX extended regex for grep -E and sed -E. It writes the pattern and the code snippet for the one you pick.
Is the regex guaranteed to be correct?
No generator can promise that. This one is told to check every example by hand against the pattern and to list the cases it does not handle, but you should still test it on your own data before relying on it.
Can it explain a regex I already have?
Yes. Paste the pattern into the description with "explain and fix this" and it will rewrite it if needed and explain each piece.
More free AI tools
Related prompts
Prefer to use ChatGPT or Claude directly? These free prompts do similar jobs.