---
title: "REGEXREPLACE in Google Sheets: syntax and examples | PracticeExcel"
description: "How to use REGEXREPLACE in Google Sheets: clean up phone numbers, spaces and codes with one pattern."
canonical_url: "https://practiceexcelonline.com/sheets/functions/regexreplace"
locale: en
meta:
  "og:description": "How to use REGEXREPLACE in Google Sheets: clean up phone numbers, spaces and codes with one pattern."
  "og:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~UkVHRVhSRVBMQUNFIGluIEdvb2dsZSBTaGVldHM6IHN5bnRheCBhbmQgZXhhbXBsZXM%2Cdescription_~SG93IHRvIHVzZSBSRUdFWFJFUExBQ0UgaW4gR29vZ2xlIFNoZWV0czogY2xlYW4gdXAgcGhvbmUgbnVtYmVycywgc3BhY2VzIGFuZCBjb2RlcyB3aXRoIG9uZSBwYXR0ZXJuLg%2Ceyebrow_Google%2BSheets%2Bpractice%2Bexercises%2Csite_practiceexcel%2Ccode_~UkVHRVhSRVBMQUNFKHRleHQsIHJlZ3VsYXJfZXhwcmVzc2lvbiwgcmVwbGFjZW1lbnQp%2Cp_Ii9zaGVldHMvZnVuY3Rpb25zL3JlZ2V4cmVwbGFjZSI%2Cs_XAyMd3_zg8vqZ2RR.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "REGEXREPLACE in Google Sheets: syntax and examples | PracticeExcel"
  "twitter:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~UkVHRVhSRVBMQUNFIGluIEdvb2dsZSBTaGVldHM6IHN5bnRheCBhbmQgZXhhbXBsZXM%2Cdescription_~SG93IHRvIHVzZSBSRUdFWFJFUExBQ0UgaW4gR29vZ2xlIFNoZWV0czogY2xlYW4gdXAgcGhvbmUgbnVtYmVycywgc3BhY2VzIGFuZCBjb2RlcyB3aXRoIG9uZSBwYXR0ZXJuLg%2Ceyebrow_Google%2BSheets%2Bpractice%2Bexercises%2Csite_practiceexcel%2Ccode_~UkVHRVhSRVBMQUNFKHRleHQsIHJlZ3VsYXJfZXhwcmVzc2lvbiwgcmVwbGFjZW1lbnQp%2Cp_Ii9zaGVldHMvZnVuY3Rpb25zL3JlZ2V4cmVwbGFjZSI%2Cs_XAyMd3_zg8vqZ2RR.png"
---

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

# **REGEXREPLACE in Google Sheets**

Replaces every part of a text that matches a pattern with new text.

=

REGEXREPLACE(

## **Syntax**

```
REGEXREPLACE(text, regular_expression, replacement)
```

<dl><dt>**text **</dt>
<dd>The text to search. It must be text; a number gives #VALUE!.</dd>
<dt>**regular_expression **</dt>
<dd>The pattern in quotes, such as "\d+" for one or more digits.</dd>
<dt>**replacement **</dt>
<dd>The text to put in its place. "" deletes what matches.</dd></dl>

## **Examples**

C1`=REGEXREPLACE(<sup>1</sup>A2,<sup>2</sup>"\D",<sup>3</sup>"")`

|  | A | B | C |
| --- | --- | --- | --- |
| 1 | Phone |  | **02079460018** |
| 2 | Tel: 020 7946 0018 |  | |

**In plain words:** In <sup>1</sup>the phone number in A2, replace <sup>2</sup>everything that is not a digit with <sup>3</sup>nothing.

C1=REGEXREPLACE(A2,"\\s+"," ")

|  | A | B | C |
| --- | --- | --- | --- |
| 1 | Name |  | **Ann Berg** |
| 2 | Ann Berg |  | |

## **Practice REGEXREPLACE**

- [**1****Keep only digits with REGEXREPLACE**→](https://practiceexcelonline.com/sheets/practice/regex/regexreplace-digits)

## **Related functions**

- [**REGEXEXTRACT**](https://practiceexcelonline.com/sheets/functions/regexextract)
- [**SUBSTITUTE**](https://practiceexcelonline.com/functions/substitute)
- [**TRIM**](https://practiceexcelonline.com/functions/trim)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://practiceexcelonline.com/#identity","@type":"Organization","name":"PracticeExcel","url":"https://practiceexcelonline.com/","logo":{"@id":"https://practiceexcelonline.com/#logo"}},{"@id":"https://practiceexcelonline.com/#website","@type":"WebSite","inLanguage":"en-US","name":"PracticeExcel","url":"https://practiceexcelonline.com/","alternateName":["Practice Excel Online","PracticeExcelOnline.com"],"publisher":{"@id":"https://practiceexcelonline.com/#identity"},"workTranslation":{"@id":"https://excelopgaver.dk/#website"}},{"@id":"https://practiceexcelonline.com/sheets/functions/regexreplace#webpage","@type":"WebPage","description":"How to use REGEXREPLACE in Google Sheets: clean up phone numbers, spaces and codes with one pattern.","name":"REGEXREPLACE in Google Sheets: syntax and examples","url":"https://practiceexcelonline.com/sheets/functions/regexreplace","breadcrumb":{"@id":"https://practiceexcelonline.com/sheets/functions/regexreplace#breadcrumb"},"isPartOf":{"@id":"https://practiceexcelonline.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://practiceexcelonline.com/sheets/functions/regexreplace"]}],"primaryImageOfPage":{"@id":"https://practiceexcelonline.com/#logo"}},{"@id":"https://practiceexcelonline.com/sheets/functions/regexreplace#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://practiceexcelonline.com","position":1},{"@type":"ListItem","name":"Google Sheets practice exercises","item":"https://practiceexcelonline.com/sheets","position":2},{"@type":"ListItem","name":"REGEXREPLACE in Google Sheets: syntax and examples","position":3}]},{"@id":"https://practiceexcelonline.com/sheets/functions/regexreplace#article","description":"How to use REGEXREPLACE in Google Sheets: clean up phone numbers, spaces and codes with one pattern.","headline":"REGEXREPLACE in Google Sheets: syntax and examples","inLanguage":"en-US","thumbnailUrl":"https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~UkVHRVhSRVBMQUNFIGluIEdvb2dsZSBTaGVldHM6IHN5bnRheCBhbmQgZXhhbXBsZXM%2Cdescription_~SG93IHRvIHVzZSBSRUdFWFJFUExBQ0UgaW4gR29vZ2xlIFNoZWV0czogY2xlYW4gdXAgcGhvbmUgbnVtYmVycywgc3BhY2VzIGFuZCBjb2RlcyB3aXRoIG9uZSBwYXR0ZXJuLg%2Ceyebrow_Google%2BSheets%2Bpractice%2Bexercises%2Csite_practiceexcel%2Ccode_~UkVHRVhSRVBMQUNFKHRleHQsIHJlZ3VsYXJfZXhwcmVzc2lvbiwgcmVwbGFjZW1lbnQp%2Cp_Ii9zaGVldHMvZnVuY3Rpb25zL3JlZ2V4cmVwbGFjZSI%2Cs_XAyMd3_zg8vqZ2RR.png","@type":["Article","TechArticle"],"author":{"@id":"https://practiceexcelonline.com/#identity"},"image":{"@id":"https://practiceexcelonline.com/#/schema/image/1"},"isPartOf":{"@id":"https://practiceexcelonline.com/sheets/functions/regexreplace#webpage"},"mainEntityOfPage":{"@id":"https://practiceexcelonline.com/sheets/functions/regexreplace#webpage"},"publisher":{"@id":"https://practiceexcelonline.com/#identity"}},{"@id":"https://practiceexcelonline.com/#logo","@type":"ImageObject","caption":"PracticeExcel","contentUrl":"https://practiceexcelonline.com/brand/practiceexcel/icon-512.png","inLanguage":"en-US","url":"https://practiceexcelonline.com/brand/practiceexcel/icon-512.png"},{"@id":"https://practiceexcelonline.com/#/schema/image/1","@type":"ImageObject","contentUrl":"https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~UkVHRVhSRVBMQUNFIGluIEdvb2dsZSBTaGVldHM6IHN5bnRheCBhbmQgZXhhbXBsZXM%2Cdescription_~SG93IHRvIHVzZSBSRUdFWFJFUExBQ0UgaW4gR29vZ2xlIFNoZWV0czogY2xlYW4gdXAgcGhvbmUgbnVtYmVycywgc3BhY2VzIGFuZCBjb2RlcyB3aXRoIG9uZSBwYXR0ZXJuLg%2Ceyebrow_Google%2BSheets%2Bpractice%2Bexercises%2Csite_practiceexcel%2Ccode_~UkVHRVhSRVBMQUNFKHRleHQsIHJlZ3VsYXJfZXhwcmVzc2lvbiwgcmVwbGFjZW1lbnQp%2Cp_Ii9zaGVldHMvZnVuY3Rpb25zL3JlZ2V4cmVwbGFjZSI%2Cs_XAyMd3_zg8vqZ2RR.png","inLanguage":"en-US","url":"https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~UkVHRVhSRVBMQUNFIGluIEdvb2dsZSBTaGVldHM6IHN5bnRheCBhbmQgZXhhbXBsZXM%2Cdescription_~SG93IHRvIHVzZSBSRUdFWFJFUExBQ0UgaW4gR29vZ2xlIFNoZWV0czogY2xlYW4gdXAgcGhvbmUgbnVtYmVycywgc3BhY2VzIGFuZCBjb2RlcyB3aXRoIG9uZSBwYXR0ZXJuLg%2Ceyebrow_Google%2BSheets%2Bpractice%2Bexercises%2Csite_practiceexcel%2Ccode_~UkVHRVhSRVBMQUNFKHRleHQsIHJlZ3VsYXJfZXhwcmVzc2lvbiwgcmVwbGFjZW1lbnQp%2Cp_Ii9zaGVldHMvZnVuY3Rpb25zL3JlZ2V4cmVwbGFjZSI%2Cs_XAyMd3_zg8vqZ2RR.png"}]}
```

## Sitemap

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