What is REGEXEXTRACT in Google Sheets?

REGEXEXTRACT returns the portion of text that matches a regular expression, often using capture groups to pull IDs, domains, or codes from longer strings. It replaces manual LEFT/RIGHT/MID chains when patterns repeat.

When to use it

Use REGEXEXTRACT to parse invoice numbers from descriptions, domains from URLs, or area codes from phone strings.

When to skip it

Skip REGEXEXTRACT when SPLIT on a reliable delimiter is enough. Simpler formulas age better for junior editors.

How it works

  1. 1

    Identify a stable pattern with parentheses around the part you want to capture.

  2. 2

    Write =REGEXEXTRACT(text, "pattern") returning the first capture group by default.

  3. 3

    Apply down a column or with MAP for bulk parsing.

  4. 4

    Combine with IFERROR when some cells lack a match.

  5. 5

    TRIM and CLEAN source text before regex when imports add junk characters.

  6. 6

    Document the pattern on a Settings tab for future you.

Examples in Google Sheets

Invoice ID

=REGEXEXTRACT(A2, "INV-(\d+)") pulls digits after INV- from a memo field.

Domain from URL

=REGEXEXTRACT(B2, "https?://([^/]+)") returns hostname from a full URL string.

ZIP from address

=REGEXEXTRACT(C2, "\b(\d{5})\b") grabs five-digit ZIP when present.

Build this without starting from a blank cell

Use a Better Sheets tool for REGEXEXTRACT, then watch a walkthrough when you want the full pattern.

Better Sheets resources

Common mistakes

  • No capture group in pattern so extract returns unexpected full match.
  • Assuming every row matches; blank or #N/A without IFERROR.
  • Greedy quantifiers capturing too much text.
  • Regex on merged label cells copied from PDFs with odd spaces.
  • Using REGEXEXTRACT where REGEXREPLACE cleanup should happen first.

Frequently asked questions

REGEXEXTRACT vs REGEXREPLACE?
EXTRACT pulls a substring. REPLACE substitutes parts of the text.
Multiple capture groups?
Google Sheets returns the first group unless pattern design merges captures.
No match result?
Often #N/A. Wrap with IFERROR or IF(REGEXMATCH(...)).
REGEXEXTRACT array?
Spills when text argument is a range.
Extract all occurrences?
One match per formula. SPLIT or repeated patterns may be needed for all.
REGEXEXTRACT numbers?
Wrap with VALUE if you need numeric math on extracted digits.
Special characters in text?
Escape regex metacharacters in literal portions of your pattern.

Related Tutorials

Watch how REGEXEXTRACT works

Browse more tutorials
200 REGEXMATCH Examples in Google Sheets

200 REGEXMATCH Examples in Google Sheets

Uncover the Magic of Regex Match! 🎩✨ Explore 200+ Examples at BetterShee...
REGEXMATCH Formula Generator for Google Sheets

REGEXMATCH Formula Generator for Google Sheets

Revolutionize the way you handle data with the BetterSheets REGEXMATCHER...

Related blog posts

Guides that explain REGEXEXTRACT in more depth.

Browse the blog

Related glossary terms

Done reading about REGEXEXTRACT?

Membership unlocks 636+ tutorials, unlimited generators, and every template. Practical lessons. Zero fluff.

Need this once

Jump to a free tool or a single tutorial for this topic.

Learning Sheets for real

Unlock the full library, generators, and templates with membership.