Home/Formulas/Text/REGEXEXTRACT
Textmedium

REGEXEXTRACT()

Returns the first matching substring (or first capture group) of a regular expression.

Syntax
fx
=REGEXEXTRACT(text, regular_expression)
Arguments
ArgumentDescription
textThe text to search.
regular_expressionThe RE2 regular expression. If it contains a capture group, that group is returned.
Example
fx
=REGEXEXTRACT("abc123", "\d+")

Paste this into Google Sheets to run it. The live playground on this site covers 24 of the 61 functions, and REGEXEXTRACT isn't one of them yet.

Related formulas
REGEXMATCH()
Returns TRUE if a piece of text matches a regular expression.
REGEXREPLACE()
Replaces every match of a regular expression with the replacement text.
MID()
Returns a segment of a string starting at a given position, for a given length.
Used by
REGEXMATCH()
Returns TRUE if a piece of text matches a regular expression.
REGEXREPLACE()
Replaces every match of a regular expression with the replacement text.