How to Use the REGEXREPLACE Function in Google Sheets

By Tomosuke Hasegawa · Updated Oct 29, 2026 · Intermediate · 6 min read · includes 2 free exercises

In short: REGEXREPLACE replaces every part of a text that matches a pattern. The formula is =REGEXREPLACE(text, regular_expression, replacement). An empty replacement "" deletes the matches.

What REGEXREPLACE does

SUBSTITUTE swaps one fixed piece of text for another. REGEXREPLACE swaps anything that matches a pattern, so one formula can clean many different values. The pattern can be as simple as a single character.

REGEXREPLACE syntax

=REGEXREPLACE(text, regular_expression, replacement)

The function accepts only text as input and returns text. To get a number back, wrap the formula in VALUE. To pass in a number, convert it with TEXT. Sheets supports RE2, except for Unicode character class matching.

A step-by-step example

Cell A2 holds a phone number with hyphens.

A
1Contact
2Phone: 090-1234-5678
=REGEXREPLACE(A2, "-", "")

This returns Phone: 09012345678. Here is why: every hyphen matches the pattern, and each one is replaced with an empty string, so all of them disappear. A pattern can also match words:

=REGEXREPLACE(A2, "Phone", "Tel")

This returns Tel: 090-1234-5678.

Common mistakes

Try it yourself

Use the cell above (A2). Type your formula into the box, starting with =, then press Check.

Exercise 1: Remove the hyphens

Write a formula that removes every hyphen from the text in A2.

Hint: replace with an empty string "".

Exercise 2: Swap a word

Write a formula that replaces the word Phone in A2 with Tel.

Hint: pattern, then replacement.

What to learn next

Syntax and rules in this guide were checked against Google's REGEXREPLACE help page. See all guides.