Google Sheets REGEXEXTRACT: Extract Numbers, Emails & Text via Regex
REGEXEXTRACT extracts matching substrings from a text string according to Google RE2 regular expression patterns. Ideal for isolating email addresses, SKU codes, domain names, and phone numbers from unstructured notes.
=REGEXEXTRACT(text, regular_expression)Technical Overview & Engine Mechanics
Formula Comparison: REGEXEXTRACT vs. Alternatives
Formula Parameters & Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
| text | Text | Required | The source string or cell coordinate. |
| regular_expression | Text (Regex) | Required | The regular expression pattern enclosed in quotes. |
Real-World Spreadsheet Examples
Explore verified operational formulas used in enterprise reporting and database workflows:
Example 1: Extract Email Address from Support Note
=REGEXEXTRACT(A2, "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}")Example 2: Extract Root Domain from Full URL
=REGEXEXTRACT(A2, "^(?:https?:\/\/)?(?:www\.)?([^\/\?#]+)")Example 3: Extract Digits Only (Invoice Number)
=REGEXEXTRACT(A2, "\d+")Example 4: Extract Domain Name from Email Address
=REGEXEXTRACT(A2, "@(.+)")Example 5: Extract Order Number and Date from Invoice Memo
=REGEXEXTRACT(A2, "Order #([0-9]+) on ([0-9]{4}-[0-9]{2}-[0-9]{2})")Common Errors & Solutions
Performance Pro Tips
- Use capture groups `()` to extract specific parts of a pattern without including surrounding prefix characters.
- Combine with ARRAYFORMULA to clean thousands of rows simultaneously: `=ARRAYFORMULA(IF(A2:A="", "", IFERROR(REGEXEXTRACT(A2:A, "\d+"))))`.
- Always wrap REGEXEXTRACT in IFERROR or IFNA to prevent #N/A calculation halts across entire columns when unmatching rows are processed.
- To extract numbers only from messy text strings, use the regex pattern "\d+" or "([0-9]+)" to pull out continuous integer blocks.
Frequently Asked Questions: REGEXEXTRACT
Can REGEXEXTRACT be used with ARRAYFORMULA?
Yes: =ARRAYFORMULA(IF(A2:A="", "", REGEXEXTRACT(A2:A, "[0-9]+"))).
How do I extract only numeric digits from a string?
=REGEXEXTRACT(A2, "\d+") or =REGEXEXTRACT(A2, "[0-9]+").
How do I extract text inside parentheses?
=REGEXEXTRACT(A2, "\(([^)]+)\)").
Is REGEXEXTRACT case-sensitive?
Yes. Use the (?i) flag at the start of the pattern for case-insensitivity: "(?i)urgent: (.+)".
Is REGEXEXTRACT available in Microsoft Excel?
Recent Excel 365 beta builds have added REGEXTRACT, but Google Sheets has natively supported it for over a decade.
Why does REGEXEXTRACT return #N/A when searching numbers?
REGEXEXTRACT requires text input. If cell A1 contains a raw number or date, wrap it in TO_TEXT(A1) or & "" before passing to REGEXEXTRACT.