0
0
Google Sheetsspreadsheet~10 mins

REGEXMATCH and REGEXEXTRACT in Google Sheets - Cell-by-Cell Formula Trace

Choose your learning style9 modes available
Sample Data

A list of email addresses in column A. Column B will check if the email looks valid using REGEXMATCH. Column C will extract the domain part of the email using REGEXEXTRACT.

CellValue
A1Email List
A2alice@example.com
A3bob123@work.net
A4carol@home.org
A5dave@invalid
B1Is Valid Email?
C1Extract Domain
Formula Trace
REGEXMATCH(A2, "^[\w.+-]+@[\w.-]+\.[a-zA-Z]{2,}$")
Step 1: A2 value is "alice@example.com"
Step 2: Pattern "^[\w.+-]+@[\w.-]+\.[a-zA-Z]{2,}$"
Step 3: Does "alice@example.com" match the pattern?
Cell Reference Map
    A               B               C
1 | Email List    | Is Valid Email? | Extract Domain
2 | alice@ex...  |                |               
3 | bob123@wo... |                |               
4 | carol@hom... |                |               
5 | dave@inva... |                |               
The formula uses cell A2 to check if the email is valid with REGEXMATCH, and later will use A2 to extract domain with REGEXEXTRACT.
Result
    A               B               C
1 | Email List    | Is Valid Email? | Extract Domain
2 | alice@ex...  | TRUE           | example.com   
3 | bob123@wo... | TRUE           | work.net      
4 | carol@hom... | TRUE           | home.org      
5 | dave@inva... | FALSE          | #N/A         
Column B shows TRUE if the email matches the pattern (valid), FALSE if not. Column C extracts the domain part after '@' for valid emails, otherwise shows error.
Sheet Trace Quiz - 3 Questions
Test your understanding
What does REGEXMATCH(A2, "^[\w.+-]+@[\w.-]+\.[a-zA-Z]{2,}$") check?
AIf A2 is empty
BIf A2 contains the word 'email'
CIf A2 contains a valid email format
DIf A2 contains only numbers
Key Result
REGEXMATCH checks if text matches a pattern; REGEXEXTRACT pulls matching text from a pattern group.