How to use the REGEXREPLACE function in Google Sheets?

How to use the REGEXREPLACE function in Google Sheets?

The REGEXREPLACE function in Google Sheets is a powerful tool that allows users to find and replace specific text patterns within a cell or range of cells. This function uses regular expressions, which are special characters and symbols that represent a set of characters, to identify the text to be replaced. To use the REGEXREPLACE function, users must first select the cell or range of cells they want to apply it to. They can then input the desired regular expression, along with the text to replace it with, in the formula bar. The function will then automatically scan the selected cells and replace any instances of the specified text pattern with the designated replacement text. This can be useful for cleaning up data, making mass changes to multiple cells, and other tasks that require pattern recognition and replacement.

REGEXREPLACE

Replaces part of a text string with a different text string using regular expressions.

Sample Usage

REGEXREPLACE("Spreadsheets", "S.*d", "Bed")

Syntax

REGEXREPLACE(text, regular_expression, replacement)

  • text – The text, a part of which will be replaced.

  • regular_expression – The regular expression. All matching instances in text will be replaced.

  • replacement – The text which will be inserted into the original text.

Notes

  • Google products use RE2 for regular expressions. Google Sheets supports RE2 except Unicode character class matching.  Learn more on how to use RE2 expressions.
  • This function only works with text (not numbers) as input and returns text as output. If a number is desired as the output, try using the VALUE function in conjunction with this function. If numbers are used as input, convert them to text using the TEXT function.

See Also

REGEXEXTRACT: Extracts the first matching substrings according to a regular expression.

REGEXMATCH: Whether a piece of text matches a regular expression.

SUBSTITUTE: Replaces existing text with new text in a string.

REPLACE: Replaces part of a text string with a different text string.

Examples

[wpcc-iframe height=”300″ src=”https://docs.google.com/spreadsheet/pub?key=0As3tAuweYU9QdGFUTDhRTFVRUkpWZmp0emhOSm1yd0E&output=html” width=”500″]

Cite this article

stats writer (2024). How to use the REGEXREPLACE function in Google Sheets?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-to-use-the-regexreplace-function-in-google-sheets/

stats writer. "How to use the REGEXREPLACE function in Google Sheets?." PSYCHOLOGICAL SCALES, 1 Jul. 2024, https://scales.arabpsychology.com/stats/how-to-use-the-regexreplace-function-in-google-sheets/.

stats writer. "How to use the REGEXREPLACE function in Google Sheets?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-to-use-the-regexreplace-function-in-google-sheets/.

stats writer (2024) 'How to use the REGEXREPLACE function in Google Sheets?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-to-use-the-regexreplace-function-in-google-sheets/.

[1] stats writer, "How to use the REGEXREPLACE function in Google Sheets?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, July, 2024.

stats writer. How to use the REGEXREPLACE function in Google Sheets?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top