Text Excel 365 ◉ 44 views

=REGEXEXTRACT()

This article shows you how REGEXEXTRACT function allows you to extract text from a string based on a supplied regular expression.

Applies To: Excel for Microsoft 365Excel for Microsoft 365 for Mac
=REGEXEXTRACT(text, pattern, [return_mode], [case_sensitivity])
Hover argument names in the table for details.
Output typeText
Popularity40 / 100
VolatileNo
Dynamic ArrayNo
Download sample .xlsx ▦ Try in Playground Dedicated file for this function — safe & lightweight · sample data + live formulas
Share:

⬇ Download Sample Workbook

A dedicated .xlsx for =REGEXEXTRACT() with Persian sample data & live formulas — open in Excel and practice.

  • Sheet “Sample” — data table + formula in place
  • Sheet “Guide” — syntax, arguments & tips from this page
  • Instant & secure (token + rate limit)
Download REGEXEXTRACT.xlsx ~ 8–12 KB · No macros

⇪ Share

Send this function to friends

Quiz this function

%d questions — syntax, example & errors — test yourself!

◧ Arguments

ArgumentTypeRequiredDescription
text Text Required The text or the reference to a cell containing the text you want to extract strings from.
pattern Text Required The regular expression ("regex") that describes the pattern of text you want to extract.
return_mode Number Required A number that specifies what strings you want to extract. By default, return mode is 0. The possible values are:0: Return the first string that matches the pattern1: Return all strings that match the pattern as an array2: Return capturing groups from the first match as an arrayNote: Capturing groups are parts of a regex pattern surrounded by parentheses "(...)". They allow you to return separate parts of a single match individually.
case_sensitivity Number Required Determines whether the match is case-sensitive. By default, the match is case-sensitive. Enter one of the following:0: Case sensitive1: Case insensitive

▣ Examples

▦ Data
CellValue
A2 DylanWilliams
A3 DylanWilliams
Example 1 =REGEXEXTRACT(A2,"[A-Z][a-z]+")
Example 2 =REGEXEXTRACT(A2,"[A-Z][a-z]+",1)
Example 3 =REGEXEXTRACT(A2,"[0-9()]+ [0-9-]+",1)

💬 Comments & Q&A 0 approved

🔒 Your comment will be published after review.

Share your thoughts — visible after admin approval

No comments yet — be the first!

✍️ Add comment / question

captcha
🔒 Your comment will be published after review.