0 of 62
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.

G2
ABCDEFG
1Full nameEmailSKUNote
2 maria lopez maria.lopez@acme.comWID-2041-BLUCall back 555-0142
3james chenjchen@northwind.ioGAD-1180-REDSent invoice
4Priya Shahpriya@shahdesign.coWID-3307-GRNCall back 555-0199
5tom o'neiltom.oneil@acme.comBOX-0042-BLULeft voicemail
6Lena Park lena.park@globex.comGAD-2215-BLKCall back 555-0107
7sam reedsreed@northwind.ioWID-0918-REDMeeting Tue
Ctrl+/ shows the shortcuts