Google Sheets
REGEXEXTRACT function in Google Sheets
Extracts matching substrings according to a regular expression.
=REGEXEXTRACT(text, regular_expression)REGEXEXTRACT syntax and parameters
Two arguments, two required.
- textstringRequired
The input text.
- regular_expressionstringRequired
The first part of text that matches this expression will be returned.
REGEXEXTRACT examples
Formulas you'll actually reuse.
The first run of digits in an order note:
=REGEXEXTRACT(A2, "[0-9]+")Result
"10422"The domain after the @ — a capture group returns just that part:
=REGEXEXTRACT(A2, "@(.+)$")Result
"example.com"
REGEXEXTRACT in Excel
Same name — your formula ports as-is.
Try REGEXEXTRACT in the playground
Edit the example — nothing to install.
Preloaded with the REGEXEXTRACT formula from Example 1 — change anything and watch it respond.
Loading the editor…
REGEXEXTRACT errors
What they mean — and the fixes.
#N/ANothing matched — Sheets uses RE2 syntax (no lookbehind); wrap in IFERROR for a blank instead.
Related functions
More ways Google Sheets gets this done.
- ARABICComputes the value of a Roman numeral.TextExcel
- CHARConvert a number into a character according to the current Unicode table.TextExcel
- CLEANReturns the text with the non-printable ASCII characters removed.TextExcel
- CODEReturns the numeric Unicode map value of the first character in the string provided.TextExcel
- CONCATENATEAppends strings to one another.TextExcel
- DOLLARFormats a number into the locale-specific currency format.TextExcel