Article content and detailed guides remain in English. The selected language applies to controls and quick instructions.

Back to articles

Using Regular Expressions in Spreadsheets for Email List Cleaning: REGEXMATCH, REGEXEXTRACT and REGEXREPLACE in Google Sheets and Power Query in Excel

On this page

Why Regex in Spreadsheets

Regular expressions (regex) let you search, validate, extract and transform text patterns inside spreadsheet formulas. For email list work, regex handles tasks that standard text functions (LEFT, RIGHT, MID, FIND, SUBSTITUTE) cannot:

Task Standard functions Regex approach
Validate email format Complex nested IF/FIND/LEN combinations that miss edge cases Single REGEXMATCH with email pattern
Extract email from mixed text Multiple nested MID/FIND formulas that break on varying positions Single REGEXEXTRACT that finds the email anywhere
Remove extra spaces and characters Multiple nested SUBSTITUTE calls Single REGEXREPLACE
Find domain from email RIGHT + LEN - FIND("@") REGEXEXTRACT with capture group after @
Identify role-based addresses Multiple OR(SEARCH("info@"),...) combinations REGEXMATCH with alternation pattern
Standardise formatting Chain of LOWER + TRIM + SUBSTITUTE REGEXREPLACE handles all in fewer steps

Google Sheets Regex Functions

Google Sheets has three built-in regex functions. All are case-sensitive by default:

Function Purpose Returns
REGEXMATCH(text, pattern) Tests whether text matches a pattern TRUE or FALSE
REGEXEXTRACT(text, pattern) Extracts the first match of a pattern from text The matched text (or captured group)
REGEXREPLACE(text, pattern, replacement) Replaces matches of a pattern with new text The modified text

REGEXMATCH: validating email format

Formula What it checks Example input Result
=REGEXMATCH(A1, "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$") Basic email format validation user@example.com TRUE
=REGEXMATCH(A1, "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$") Missing @ symbol userexample.com FALSE
=REGEXMATCH(A1, "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$") Missing domain user@ FALSE
=REGEXMATCH(A1, "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$") Multiple @ symbols user@@example.com FALSE

Identifying role-based email addresses

Formula What it identifies Example matches
=REGEXMATCH(LOWER(A1), "^(info|admin|support|sales|contact|hello|help|office|billing|noreply|no-reply|postmaster|webmaster|abuse|marketing)@") Common role-based prefixes info@example.com, sales@example.com

Identifying disposable email domains

Formula What it identifies Example matches
=REGEXMATCH(LOWER(A1), "@(mailinator|guerrillamail|tempmail|throwaway|yopmail|sharklasers|guerrillamailblock|grr|dispostable|trashmail).") Common disposable email domains user@mailinator.com, test@yopmail.com

REGEXEXTRACT: extracting emails from text

Formula What it extracts Example input Result
=REGEXEXTRACT(A1, "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}") First email address from any text "Contact John at john@example.com for details" john@example.com
=REGEXEXTRACT(A1, "@([a-zA-Z0-9.-]+.[a-zA-Z]{2,})") Domain from email address user@example.com example.com
=REGEXEXTRACT(A1, "^([^@]+)@") Local part (before @) from email user.name@example.com user.name
=REGEXEXTRACT(A1, ".([a-zA-Z]{2,})$") TLD from email user@example.co.uk uk

REGEXREPLACE: cleaning email data

Formula What it does Before After
=REGEXREPLACE(A1, "\s+", "") Remove all whitespace " user@ example .com " user@example.com
=REGEXREPLACE(A1, "[<>"']", "") Remove angle brackets and quotes "user@example.com" user@example.com
=REGEXREPLACE(A1, "^(mailto:)", "") Remove mailto: prefix mailto:user@example.com user@example.com
=REGEXREPLACE(A1, "\s*(,|;||)\s*", ",") Standardise delimiters between multiple emails "a@b.com; c@d.com | e@f.com" a@b.com,c@d.com,e@f.com
=REGEXREPLACE(A1, "[^\x00-\x7F]", "") Remove non-ASCII characters user@examplé.com user@exampl.com

Excel Alternatives

Excel does not have built-in REGEXMATCH, REGEXEXTRACT or REGEXREPLACE functions. Alternative approaches:

Text functions for basic validation

Task Excel formula Limitation
Check for @ symbol =AND(ISERROR(FIND(" ",A1)), NOT(ISERROR(FIND("@",A1))), NOT(ISERROR(FIND(".",A1,FIND("@",A1))))) Does not validate full email format
Extract domain =MID(A1,FIND("@",A1)+1,LEN(A1)-FIND("@",A1)) Breaks if no @ present
Extract local part =LEFT(A1,FIND("@",A1)-1) Breaks if no @ present

Power Query M-language (Excel)

Power Query (Get and Transform Data) supports text pattern matching. While M-language does not have full regex, it handles common email cleaning tasks:

Task M-language approach Example
Trim whitespace Text.Trim([Email]) Removes leading and trailing spaces
Lowercase Text.Lower([Email]) Standardises case
Contains @ check Text.Contains([Email], "@") Basic validation
Extract domain Text.AfterDelimiter([Email], "@") Gets domain from email
Extract local part Text.BeforeDelimiter([Email], "@") Gets local part from email
Replace characters Text.Replace([Email], "<", "") Removes specific characters

LAMBDA and LET functions (Excel 365)

Excel 365 users can create custom regex-like functions using LAMBDA:

Task Approach Notes
Basic email validation =LET(email,A1,hasAt,ISNUMBER(FIND("@",email)),hasDot,ISNUMBER(FIND(".",email,FIND("@",email)+1)),noSpace,ISERROR(FIND(" ",email)),AND(hasAt,hasDot,noSpace,LEN(email)>5)) Approximates basic email validation without true regex

Practical Email Cleaning Workflow in Google Sheets

Step-by-step column-based cleaning

Column Formula Purpose
A Raw email data (paste or import) Original data
B =LOWER(TRIM(A1)) Lowercase and trim whitespace
C =REGEXREPLACE(B1, "[<>"'()]", "") Remove brackets, quotes, parentheses
D =REGEXREPLACE(C1, "^mailto:", "") Remove mailto: prefix
E =REGEXMATCH(D1, "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$") Validate format (TRUE / FALSE)
F =IF(E1, REGEXEXTRACT(D1, "@(.+)$"), "INVALID") Extract domain (if valid)
G =REGEXMATCH(LOWER(D1), "^(info|admin|support|sales|noreply|no-reply)@") Flag role-based (TRUE / FALSE)
H =IF(AND(E1, NOT(G1)), D1, "") Final clean email (valid and not role-based)

When to Use Email Extractor Instead

Spreadsheet regex works well for cleaning and validating small lists (hundreds to a few thousand emails). For larger tasks, Email Extractor handles extraction and deduplication more efficiently:

Task Spreadsheet regex Email Extractor
Extract emails from a few cells of text Good: REGEXEXTRACT formula Not needed for small amounts
Validate format of a short list Good: REGEXMATCH column Not needed for small lists
Extract emails from large files (CSV, XLSX, PDF, DOCX, HTML) Slow and complex for multiple files Upload files directly; automatic extraction
Deduplicate across multiple sources Manual: COUNTIF + remove duplicates Automatic case-insensitive deduplication
Extract from file types spreadsheets cannot open (PDF, DOCX, EML, MSG, VCF) Cannot do Supports 19 file types
Process multiple files at once One at a time Batch processing up to 100 MB

For best results, use Email Extractor for bulk extraction and deduplication, then use spreadsheet regex formulas for additional cleaning, validation, segmentation and enrichment of the extracted list.

Extract emails

Explore tools

Verify emails

Check address validity before using your list.

ZeroBounce

Email Verification

Verifies email lists and provides tools for monitoring deliverability.

Useful when list cleaning and sender health belong in one workflow.

Explore ZeroBounce (opens in a new tab)