Skip to main content
← All functions

REGEXEXTRACT function

Extract text matched by a regular expression.

This reference covers the native Excel function. Its required application features or connected services are not implemented by the local worksheet engine. Check the linked Microsoft documentation for availability and complete option values.

Syntax

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

Square brackets indicate optional arguments.

Arguments

ArgumentRequiredMeaning
textYesText to examine or process.
patternYesA regular expression describing the text to match; Excel uses PCRE2 syntax.
return_modeNoSelects whether the extraction returns a match, multiple matches or captured groups.
case_sensitivityNoControls whether uppercase and lowercase characters are distinguished.

Try REGEXEXTRACT

Extract a reference from a longer status message

=REGEXEXTRACT(A2,"[A-Z]{2}-[0-9]{4}")

The pattern finds two capital letters, a hyphen and four digits inside the message. The default mode returns the first match. Native Excel supports PCRE2; this sample checks the stated common pattern.

Inspect the current formula

Read its written arguments or observe actual operation values in a separate local calculation. This action neither applies a draft nor grades an answer.

Read the formula, one argument at a time

Explore the written function calls and their inputs. The calculation result belongs to the complete formula.

REGEXEXTRACT · top-level call

=REGEXEXTRACT(A2,"[A-Z]{2}-[0-9]{4}")

1 / 2 · text

Text to examine or process.

REGEXEXTRACT reference ↗

Follow the cells behind a result

Read explicit local references and helper formulas using a separate calculation. Your draft stays in this field; the worksheet and practice checks do not change.

The worksheet runs locally. Published checks apply to the supplied example only. Native Excel and Google Sheets compatibility remain unverified.

Reference and compatibility

Original SheetTutor reference notes / Microsoft documentation. Calculation checks cover the supplied examples only. The browser worksheet does not implement every Excel feature, external service or connected data type.