
TextLevel: ExpertAvailable in: Excel 365 / 2021+
In this article
- Syntax
- Examples
- Example 1
- Example 2
- Related functions
REGEXEXTRACT returns the part of text that matches a pattern — invoice numbers, phone numbers, amounts buried in narration.
Syntax
=REGEXEXTRACT(text, pattern, [return_mode], [case_sensitivity])
| Argument |
What it means |
return_mode |
0 first match, 1 all matches, 2 capture groups. |
Examples
Example 1
=REGEXEXTRACT(A2, "INV-\d+")
Invoice number from a bank narration line.
Example 2
=REGEXEXTRACT(A2, "[6-9]\d{9}")
A 10-digit Indian mobile number.
REGEXTEST · TEXTBEFORE · MID
📚 Part of the free Excel course: Beginner → Expert · Try it in the Formula Lab or ask the AI Helper.
✨ Ask AI about this articleStuck on a step? Ask a question and the AI answers using this article.
Free · AI can be wrong