Home › Functions › Text › REGEXEXTRACT
fx
REGEXEXTRACT
Text  ·  Since: Microsoft 365  ·  9 languages

The REGEXEXTRACT function allows you to extract text from a string based on a supplied regular expression. You can extract the first match, all matches or capturing groups from the first match.

🌐 Translations

English REGEXEXTRACT
Deutsch REGEXEXTRACT
Français REGEXEXTRACT
Español REGEXEXTRACT
Italiano REGEXTRACT
Português REGEXEXTRACT
Nederlands REGEXEXTRACT
Polski REGEXEXTRACT
Русский REGEXEXTRACT

📦 Availability

Excel versionAvailable
Excel 2007 ✗
Excel 2013 ✗
Excel 2019 ✗
Excel 2021 ✗
Microsoft 365 ✓
Translate a formula with this function
fx EN
fx DE

⌨ Syntax

REGEXEXTRACT(text,pattern,[return_mode],[case_sensitivity])

Arguments

text (required) — The text or the reference to a cell containing the text you want to extract strings from.
pattern (required) — The regular expression ("regex") that describes the pattern of text you want to extract.
return_mode (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 pattern 1: Return all strings that match the pattern as an array 2: Return capturing groups from the first match as an array Note: 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 (required) — Determines whether the match is case-sensitive. By default, the match is case-sensitive. Enter one of the following: 0: Case sensitive 1: Case insensitive

▶ Examples

=REGEXEXTRACT(A2,"[A-Z][a-z]+")
=REGEXEXTRACT(A2,"[A-Z][a-z]+",1)
=REGEXEXTRACT(A2,"[0-9()]+ [0-9-]+",1)

Related functions

Copied to clipboard