Category: FUNCTION | Updated: 2026-11-22

How to Use the REGEXREPLACE Function in Google Sheets | Bulk Replace Text with Regular Expressions

How to Use the REGEXREPLACE Function

The REGEXREPLACE function is a Google Sheets text function that searches a text string for substrings matching a regular expression pattern and replaces them with a specified replacement string.

Syntax

=REGEXREPLACE(text, regular_expression, replacement)
  • text: The original text string or cell reference (e.g., A2) to modify (required).
  • regular_expression: The regular expression pattern to search for, enclosed in double quotation marks (") (required).
  • replacement: The new text string to replace each match with (required). Use "" (an empty string) to delete matched text.

Examples

Here are examples of removing unwanted symbols and standardizing formatting in a dataset.

Row Column A (Source Data) Column B (Replaced Result) Formula Used
1 Source Data Replaced Result Formula Used
2 090-1234-5678 09012345678 =REGEXREPLACE(A2, "-", "")
3 Total: ¥12,500 12500 =REGEXREPLACE(A3, "[^0-9]", "")
4 John Doe Jr. John Doe Jr. =REGEXREPLACE(A4, "\s+", " ")
5 2026/11/22 2026-11-22 =REGEXREPLACE(A5, "([0-9]{4})/([0-9]{2})/([0-9]{2})", "$1-$2-$3")
  • Formula in B3: =REGEXREPLACE(A3, "[^0-9]", "") → Replaces [^0-9] (any non-digit character) with an empty string, stripping currency symbols, labels, and commas at once.
  • Formula in B5: Using $1, $2, and $3 in the replacement string lets you reuse text captured by parentheses () groups to reformat dates or codes.

Common Errors and Tips

  • Numeric input causes a #VALUE! error: Because REGEXREPLACE operates on text, passing a pure number or date cell as the first argument can cause a #VALUE! error. Convert it to text with A2&"" if needed.
  • Returns the original text if no match is found: Unlike REGEXEXTRACT, if no part of the text matches the pattern, no error is thrown and the original string is returned unchanged.
  • Replaces all matches in the text: If the regular expression matches multiple parts of the string, every match is replaced, not just the first one.

Frequently Asked Questions

Q. How do I delete specific characters or symbols using REGEXREPLACE?

A. Specify an empty string "" as the third argument (replacement). For example, "=REGEXREPLACE(A2, "[^0-9]", "")" removes all non-numeric characters and symbols, leaving only digits.

Q. What is the difference between REGEXREPLACE and SUBSTITUTE?

A. SUBSTITUTE replaces a fixed text string, whereas REGEXREPLACE uses regular expression patterns to perform flexible bulk replacements such as all digits, consecutive spaces, or specific symbol patterns.