REGEXEXTRACT Function in Excel: Pull Text That Matches a Pattern

⏱ 1 min readUpdated 28 September 2026

TextLevel: ExpertAvailable in: Excel 365 / 2021+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. Example 2
  5. 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 article

Stuck on a step? Ask a question and the AI answers using this article.

Free · AI can be wrong