Regex formula generator
Extract, match and replace text with regex
Describe what you need to find, like emails, order numbers or digits. Get the formula, the pattern explained token by token, and a live tester.
- Pattern explained
- Live tester
- RE2 and PCRE aware
Your recent formulas
Saved in this browser only.
Cheat sheet
Regex building blocks
\dAny digit 0–9\wA letter, digit or underscore\sA space, tab or line break.Any single character[A-Z]One character from the range[^0-9]One character NOT in the range+One or more of the previous item*Zero or more of the previous item{3}Exactly 3 of the previous item^ … $Start and end of the text( … )A group; REGEXEXTRACT returns it(?i)Ignore upper/lower case
More free spreadsheet tools
Everything you need when a formula gets in the way.
- Formula generatorDescribe it in plain English, get a working formula.Open tool
- Formula explainerPaste any formula and see what each part does.Open tool
- Formula fixerFix #N/A, #VALUE!, #REF! and wrong results.Open tool
- Excel ↔ Sheets converterTranslate formulas between Excel and Google Sheets.Open tool
- Clean my dataTrim, dedupe and tidy a table, privately in your browser.Open tool
- VBA & Apps ScriptMacros for Excel and scripts for Google Sheets.Open tool
- Conditional formattingCustom-formula rules to highlight cells and rows.Open tool
Frequently asked questions
Which regex functions do Excel and Google Sheets have?
Google Sheets has REGEXMATCH, REGEXEXTRACT and REGEXREPLACE. Microsoft 365 Excel has REGEXTEST, REGEXEXTRACT and REGEXREPLACE. Excel 2021 and older have no regex functions, so the tool also gives a non-regex alternative when you choose an older version.
Why does my pattern work in Excel but not in Google Sheets?
Google Sheets uses the RE2 engine, which does not support lookaheads and lookbehinds such as (?=…). Excel uses PCRE2, which does. Choose your app and the generator only uses features that app supports.
Can I test the pattern before using it?
Yes. Each result includes a live tester. Edit the pattern or the sample text and see the matches highlighted instantly in your browser.
How do I make a match case-insensitive?
Start the pattern with (?i), for example (?i)invoice. In Excel 365 you can also set the case_sensitivity argument of REGEXTEST to 1.