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
Identify a stable pattern with parentheses around the part you want to capture.
-
2
Write =REGEXEXTRACT(text, "pattern") returning the first capture group by default.
-
3
Apply down a column or with MAP for bulk parsing.
-
4
Combine with IFERROR when some cells lack a match.
-
5
TRIM and CLEAN source text before regex when imports add junk characters.
-
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.
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
200 REGEXMATCH Examples in Google Sheets
REGEXMATCH Formula Generator for Google Sheets
Related blog posts
Guides that explain REGEXEXTRACT in more depth.
Philippines Phone Number Validation: Use of REGEXMATCH in Google Sheets
Every school year thousands of students and teachers’ data were being added to the school database. As someone who was always given the task to narrow down lots of information after the school enrollment, validating students’ data manually is very exhausting. Take this as an example, when you ask students to include the phone numbers of their emergency contact person, there are some instances wherein the declared numbers were invalid due to human error. And the assigned personnel during enr...
Read post →Extract URLs from Google Sheets
Extract url from hyperlink google sheets.Skip the Command K. This Google Sheet tutorial will make it easier for you to extract URLS from Google Sheets.
Read post →Related terms
REGEXREPLACE
REGEXREPLACE finds text matching a regex pattern and replaces it with new text. Strip non-digits from phones, normalize spaces, or remove tags from HTML snippets in bulk without one-off find-and-replace menus.
Read guide →REGEXMATCH
REGEXMATCH returns TRUE or FALSE when text matches a regular expression pattern. Use it in FILTER, IF, and COUNTIF to validate emails, extract structure flags, or flag messy imports before they break downstream reports.
Read guide →SPLIT
SPLIT divides one text cell into multiple cells spilled across columns using a delimiter such as comma, space, or custom string. It is the formula version of Text to columns for live data like tags, full names, or combined codes.
Read guide →TEXTJOIN
TEXTJOIN merges many text values into one string with a delimiter between them. The ignore_empty argument skips blanks so you do not get double commas. It builds display labels, CSV-like rows, and summary lines from wide tables.
Read guide →Done reading about REGEXEXTRACT?
Membership unlocks 600+ 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.