Quick Navigation
REGEXEXTRACT Function
Summary
The REGEXEXTRACT function extracts text strings from data using powerful regular expression patterns. Perfect for pulling specific information like phone numbers, emails, dates, or custom formats from unstructured text.
Syntax
REGEXEXTRACT(text, pattern, [return_mode], [case_sensitivity])
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | Text |
Yes | The text or cell reference containing data to extract from |
| pattern | Text |
Yes | PCRE2 regular expression pattern to match |
| return_mode | Number |
No | Controls output: 0=first match, 1=all matches, 2=capturing groups |
| case_sensitivity | Number |
No | 0=case sensitive (default), 1=case insensitive |
Using the REGEXEXTRACT Function
REGEXEXTRACT revolutionizes text processing in Excel by enabling pattern-based extraction from any text data. Use it to parse emails, phone numbers, product codes, or any structured data embedded in text without complex string functions.
Common REGEXEXTRACT Examples
Extract First Name from CamelCase
=REGEXEXTRACT(A2,"[A-Z][a-z]+")
From "DylanWilliams" extracts "Dylan" (first capitalized word)
Extract All Names from CamelCase
=REGEXEXTRACT(A2,"[A-Z][a-z]+",1)
From "DylanWilliams" returns array {"Dylan","Williams"}
Extract All Phone Numbers
=REGEXEXTRACT(A2,"[0-9()]+ [0-9-]+",1)
Extracts multiple phone numbers like "(378) 555-4195" from mixed text
Extract Email Domain with Groups
=REGEXEXTRACT(A2,"([a-z]+)@([a-z.]+)",2)
From "[email protected]" with pattern captures "example.com" as group 2
Frequently Asked Questions
Common Errors and Solutions
#VALUE! error
Cause: Invalid regex pattern syntax
Solution: Check pattern for unescaped special characters, use regex101.com to test
Empty result
Cause: Pattern doesn't match any text
Solution: Verify pattern with REGEXTEST first, check case sensitivity
Spill error with return_mode=1
Cause: Not enough space for array results
Solution: Clear cells below/right of formula or use fewer matches
Notes
- Always returns text - use VALUE() for numeric conversion
- PCRE2 supports advanced features: lookaheads, conditionals, recursion
- Default case-sensitive matching
- Capturing groups numbered from left: (1), (2), etc.
- Use double backslashes \\ in Excel for regex escapes
Compatibility
Available in: Excel 365, Excel 2021, Excel 2019
Not available in: Excel 2016 and earlier
Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 365, Excel 2021, Excel 2019