AI regex generator
GPTExcel's regex generator writes a regular expression from a plain-English description, in the flavor your language uses: JavaScript, PCRE (PHP / Perl), Python, .NET, Java, or Go. It also explains existing patterns token by token, and you can test a pattern against sample text right away.
How it works
From plain English to a tested pattern
- 1
Pick the regex flavor
Choose JavaScript, PCRE (PHP / Perl), Python (re), .NET, Java, or Go (RE2), so the pattern only uses syntax your engine supports.
- 2
Describe what to match
Explain the text you want to match or capture, e.g. “Capture the year, month, and day from an ISO date”.
- 3
Generate the pattern
GPTExcel returns the raw pattern, any flags it needs, and a breakdown of what each part does.
- 4
Test it
The generated pattern drops into the built-in tester, where you paste sample text, toggle flags, and see every match and capture group. The tester runs in your browser's JavaScript engine.
Example
One prompt, one result
A typical request and the kind of answer the Regex tool returns. AI output varies, so check it against your own data before you rely on it.
Capture the year, month, and day from an ISO date
Generated pattern
A pattern that matches an ISO 8601 date like 2026-09-24 and captures each part in a named group.
^(?<year>\d{4})-(?<month>0[1-9]|1[0-2])-(?<day>0[1-9]|[12]\d|3[01])$(?<year>\d{4})captures a four-digit year(?<month>0[1-9]|1[0-2])captures a month from 01 to 12(?<day>0[1-9]|[12]\d|3[01])captures a day from 01 to 31^and$anchor the match to the whole string; add themflag to match one date per line
Supported flavors
Written for the tool you actually use
Every mode works with every option below: Generate, Explain, Optimize.
JavaScript
PCRE (PHP / Perl)
Python (re)
.NET
Java
Go (RE2)
Frequently asked questions
- Which regex flavors are supported?
- JavaScript, PCRE (PHP / Perl), Python (re), .NET, Java, and Go (RE2). Choose the flavor before you generate so the pattern avoids syntax your engine doesn't support.
- Can I test the pattern before using it?
- Yes. The regex tool includes a tester: paste sample text, toggle the g, i, m, s, and u flags, and see each match with its capture groups. The tester runs in your browser's JavaScript regex engine.
- Can it explain a regex I found somewhere else?
- Yes. Paste the pattern into Explain mode for a token-by-token breakdown, or into Optimize mode to simplify it and remove catastrophic backtracking.
- Is the regex generator free?
- Yes, you can start free. The free plan includes 4 tool runs every 12 hours, shared across the Formula, Script, SQL, Regex, and Template tools, and paid plans raise that limit. You need a free GPTExcel account to use it.
Try the Regex tool free
No credit card required. The free plan includes 4 tool runs every 12 hours.
Sign in and start generating