Text·Lesson 43 of 62Pro
How to use REGEXEXTRACT in Google Sheets
Pull out a pattern
How REGEXEXTRACT works
REGEXEXTRACT returns the part of text that matches a pattern. Brackets mark the part you want back.
REGEXEXTRACT(text, pattern)
Example on this data
=REGEXEXTRACT(C2,"-(\d+)-")→2041
The digits between the two dashes.
What you’ll do
You’ll pull the domain out of an email address. Extracting part of the text by its pattern is great for grouping contacts by company.
Try it
Type =REGEXEXTRACT(C2,"-(\d+)-") into G2 and press Enter. Watch what the sheet does.
The result will appear in G2.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Full name | SKU | Note | ||||
| 2 | maria lopez | maria.lopez@acme.com | WID-2041-BLU | Call back 555-0142 | |||
| 3 | james chen | jchen@northwind.io | GAD-1180-RED | Sent invoice | |||
| 4 | Priya Shah | priya@shahdesign.co | WID-3307-GRN | Call back 555-0199 | |||
| 5 | tom o'neil | tom.oneil@acme.com | BOX-0042-BLU | Left voicemail | |||
| 6 | Lena Park | lena.park@globex.com | GAD-2215-BLK | Call back 555-0107 | |||
| 7 | sam reed | sreed@northwind.io | WID-0918-RED | Meeting Tue |
Ctrl+/ shows the shortcuts
Drill locked
Unlock the other 44 lessons for $49.99
You’ve seen how REGEXEXTRACT works. Pro lets you write it yourself on real data and get checked instantly, with practice sets and section reviews for every lesson.
Your drill
In G2, pull out the domain (everything after @) from the email in B2.
One payment, no subscription.