---
title: "REGEX functions practice in Google Sheets | ExcelSavvy"
description: "Practice REGEXMATCH, REGEXEXTRACT and REGEXREPLACE in Google Sheets with regular expressions in a live grid."
canonical_url: "https://excelsavvy.com/sheets/practice/regex"
meta:
  "og:description": "Practice REGEXMATCH, REGEXEXTRACT and REGEXREPLACE in Google Sheets with regular expressions in a live grid."
  "og:image": "https://excelsavvy.com/_og/d/c_Page%2Ctitle_REGEX%2Bfunctions%2Bpractice%2Bin%2BGoogle%2BSheets%2Cdescription_~UHJhY3RpY2UgUkVHRVhNQVRDSCwgUkVHRVhFWFRSQUNUIGFuZCBSRUdFWFJFUExBQ0UgaW4gR29vZ2xlIFNoZWV0cyB3aXRoIHJlZ3VsYXIgZXhwcmVzc2lvbnMgaW4gYSBsaXZlIGdyaWQu%2Ceyebrow_Google%2BSheets%2Bpractice%2Bexercises%2Csite_practiceexcel%2Cprops_eyJncmlkIjp7ImNvbHMiOlsiQSIsIkIiXSwicm93cyI6W3sibiI6MSwiY2VsbHMiOlsiTm90ZSIsIkhhcyBhIG51bWJlciJdfSx7Im4iOjIsImNlbGxzIjpbIk9yZGVyIDEwMDEgc2hpcHBlZCIsIiJdfV0sInRhcmdldCI6WzEsMV19fQ%2Cp_Ii9zaGVldHMvcHJhY3RpY2UvcmVnZXgi%2Cs_adHQBhm6Bsz9cxHP.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "REGEX functions practice in Google Sheets | ExcelSavvy"
  "twitter:image": "https://excelsavvy.com/_og/d/c_Page%2Ctitle_REGEX%2Bfunctions%2Bpractice%2Bin%2BGoogle%2BSheets%2Cdescription_~UHJhY3RpY2UgUkVHRVhNQVRDSCwgUkVHRVhFWFRSQUNUIGFuZCBSRUdFWFJFUExBQ0UgaW4gR29vZ2xlIFNoZWV0cyB3aXRoIHJlZ3VsYXIgZXhwcmVzc2lvbnMgaW4gYSBsaXZlIGdyaWQu%2Ceyebrow_Google%2BSheets%2Bpractice%2Bexercises%2Csite_practiceexcel%2Cprops_eyJncmlkIjp7ImNvbHMiOlsiQSIsIkIiXSwicm93cyI6W3sibiI6MSwiY2VsbHMiOlsiTm90ZSIsIkhhcyBhIG51bWJlciJdfSx7Im4iOjIsImNlbGxzIjpbIk9yZGVyIDEwMDEgc2hpcHBlZCIsIiJdfV0sInRhcmdldCI6WzEsMV19fQ%2Cp_Ii9zaGVldHMvcHJhY3RpY2UvcmVnZXgi%2Cs_adHQBhm6Bsz9cxHP.png"
---

> Index of every page on this site: [llms.txt](https://excelsavvy.com/llms.txt)

# **REGEX functions practice in Google Sheets**

Find, pull out and replace patterns in text with REGEXMATCH, REGEXEXTRACT and REGEXREPLACE.

[**Start the first exercise**](https://excelsavvy.com/sheets/practice/regex/regexmatch)

REGEXEXTRACT(REGEXMATCH(REGEXREPLACE(

## **How REGEXMATCH, REGEXEXTRACT and REGEXREPLACE work**

The REGEX functions work with patterns instead of exact text. REGEXMATCH(text, pattern) answers TRUE or FALSE, depending on whether the pattern is found. REGEXEXTRACT(text, pattern) returns the first piece of text that fits. REGEXREPLACE(text, pattern, replacement) swaps every piece that fits for new text. The pattern is a regular expression in quotes, for example `**\d+**` for one or more digits.

If A2 holds Order 4821 shipped, `**=REGEXEXTRACT(A2,"\d+")**` returns 4821 and `**=REGEXMATCH(A2,"\d+")**` returns TRUE. `**=REGEXREPLACE(A2,"\D","")**` removes everything that is not a digit, so you are left with 4821.

REGEXMATCH finds the pattern anywhere in the text, so add ^ at the start and $ at the end when the whole cell must fit. Patterns are case-sensitive, but putting (?i) first makes them ignore case. REGEXEXTRACT returns only the first match, and an error if nothing fits. The exercises below cover testing for a number, pulling out an order number and keeping only digits.

1. [**1****Test text with REGEXMATCH**In B2, use REGEXMATCH to check whether the note in A2 contains a number. The pattern \\d+ means one or more digits.](https://excelsavvy.com/sheets/practice/regex/regexmatch)
2. [**2****Pull out a number with REGEXEXTRACT****Premium**In B2, use REGEXEXTRACT to pull the order number out of the note in A2. Use the pattern \\d+.](https://excelsavvy.com/sheets/practice/regex/regexextract-number)
3. [**3****Keep only digits with REGEXREPLACE****Premium**In B2, use REGEXREPLACE to remove everything from A2 that is not a digit. \\D (capital D) means any character that is not a digit.](https://excelsavvy.com/sheets/practice/regex/regexreplace-digits)

## **Functions in this topic**

- [**REGEXEXTRACT**](https://excelsavvy.com/sheets/functions/regexextract)
- [**REGEXMATCH**](https://excelsavvy.com/sheets/functions/regexmatch)
- [**REGEXREPLACE**](https://excelsavvy.com/sheets/functions/regexreplace)

## **Questions**

<details>

<summary>

### Which regular expression syntax does Google Sheets use?

</summary>

Google Sheets uses RE2. It covers the everyday tools such as \\d for digits, \\w for letters and digits, \\s for spaces, + and \* for repeats, and \[abc] for a set of characters. It does not support lookahead, lookbehind or backreferences, so a pattern that works in another tool can give an error here.

</details>

<details>

<summary>

### How do I check for one of several words with REGEXMATCH?

</summary>

Separate the words with a vertical bar, which means or. =REGEXMATCH(A2,"red|blue|green") returns TRUE if the cell contains any of the three words. Add (?i) at the start of the pattern if capital letters should not matter, and wrap the words in ^( and )$ if the whole cell has to match one of them.

</details>

<details>

<summary>

### How do I pull an email address out of text?

</summary>

Use a pattern for the characters before and after the @ sign: =REGEXEXTRACT(A2,"\[\\w.-]+@\[\\w.-]+"). It returns the first address in the cell and works for most common addresses. If a cell has no address, you get an error, so wrap the formula in IFERROR to show a blank instead.

</details>

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://excelsavvy.com/#identity","@type":"Organization","name":"ExcelSavvy","url":"https://excelsavvy.com/","logo":{"@id":"https://excelsavvy.com/#logo"}},{"@id":"https://excelsavvy.com/#website","@type":"WebSite","inLanguage":"en-US","name":"ExcelSavvy","url":"https://excelsavvy.com/","alternateName":["Excel Savvy","ExcelSavvy.com","PracticeExcel","Practice Excel Online"],"publisher":{"@id":"https://excelsavvy.com/#identity"},"workTranslation":[{"@id":"https://excelopgaver.dk/#website"},{"@id":"https://excelpraxis.de/#website"}]},{"@id":"https://excelsavvy.com/sheets/practice/regex#webpage","description":"Practice REGEXMATCH, REGEXEXTRACT and REGEXREPLACE in Google Sheets with regular expressions in a live grid.","name":"REGEX functions practice in Google Sheets","url":"https://excelsavvy.com/sheets/practice/regex","@type":["WebPage","CollectionPage","FAQPage"],"breadcrumb":{"@id":"https://excelsavvy.com/sheets/practice/regex#breadcrumb"},"isPartOf":{"@id":"https://excelsavvy.com/#website"},"mainEntity":[{"@id":"https://excelsavvy.com/sheets/practice/regex#/schema/question/1"},{"@id":"https://excelsavvy.com/sheets/practice/regex#/schema/question/2"},{"@id":"https://excelsavvy.com/sheets/practice/regex#/schema/question/3"}],"potentialAction":[{"@type":"ReadAction","target":["https://excelsavvy.com/sheets/practice/regex"]}],"primaryImageOfPage":{"@id":"https://excelsavvy.com/#logo"}},{"@id":"https://excelsavvy.com/sheets/practice/regex#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://excelsavvy.com","position":1},{"@type":"ListItem","name":"Google Sheets practice exercises","item":"https://excelsavvy.com/sheets","position":2},{"@type":"ListItem","name":"REGEX functions practice in Google Sheets","position":3}]},{"@id":"https://excelsavvy.com/sheets/practice/regex#/schema/question/1","@type":"Question","inLanguage":"en-US","name":"Which regular expression syntax does Google Sheets use?","acceptedAnswer":{"@type":"Answer","text":"Google Sheets uses RE2. It covers the everyday tools such as \\d for digits, \\w for letters and digits, \\s for spaces, + and * for repeats, and [abc] for a set of characters. It does not support lookahead, lookbehind or backreferences, so a pattern that works in another tool can give an error here."}},{"@id":"https://excelsavvy.com/sheets/practice/regex#/schema/question/2","@type":"Question","inLanguage":"en-US","name":"How do I check for one of several words with REGEXMATCH?","acceptedAnswer":{"@type":"Answer","text":"Separate the words with a vertical bar, which means or. =REGEXMATCH(A2,\"red|blue|green\") returns TRUE if the cell contains any of the three words. Add (?i) at the start of the pattern if capital letters should not matter, and wrap the words in ^( and )$ if the whole cell has to match one of them."}},{"@id":"https://excelsavvy.com/sheets/practice/regex#/schema/question/3","@type":"Question","inLanguage":"en-US","name":"How do I pull an email address out of text?","acceptedAnswer":{"@type":"Answer","text":"Use a pattern for the characters before and after the @ sign: =REGEXEXTRACT(A2,\"[\\w.-]+@[\\w.-]+\"). It returns the first address in the cell and works for most common addresses. If a cell has no address, you get an error, so wrap the formula in IFERROR to show a blank instead."}},{"@id":"https://excelsavvy.com/#logo","@type":"ImageObject","caption":"ExcelSavvy","contentUrl":"https://excelsavvy.com/brand/practiceexcel/icon-512.png?v=3","inLanguage":"en-US","url":"https://excelsavvy.com/brand/practiceexcel/icon-512.png?v=3"}]}
```

## Sitemap

See the full [sitemap](https://excelsavvy.com/sitemap.md) for all pages.
