Skip to content
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.

  1. The first run of digits in an order note:

    =REGEXEXTRACT(A2, "[0-9]+")

    Result"10422"

  2. 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/A

    Nothing matched — Sheets uses RE2 syntax (no lookbehind); wrap in IFERROR for a blank instead.