Calc REGEXEXTRACT function

Extracts matching substrings according to a regular expression.

Help CentreFunctions & Formulas

For a full list of available calculation functions, please read What calculation functions are supported.

This article describes the formula syntax and usage of the REGEXEXTRACT function.


Description

Extracts matching substrings according to a regular expression.


Syntax

REGEXEXTRACT(text, regular_expression)


The REGEXEXTRACT function has the following arguments:
  • text - Required. The text to search for a match.
  • regular_expression - Required. The regular expression to match against text.

Remarks

  • If there is no match, REGEXEXTRACT returns an error.
  • The regular expression must match the entire text string. If you want to extract only part of the text, use parentheses in the regular expression to capture the part you want to extract.

Example

FormulaDescriptionResult
=REGEXEXTRACT("abc123", "[0-9]+")Extracts the first sequence of digits from the string "abc123".123

Errors

For a full list of formula errors, please read Formula errors.


Related functions

See it working on your own data

Everything documented here ships with the platform – try the document tools free, or go live in 7 days.