REGEXREPLACE Function
Replace the text that matches a regular expression. text is the text to change, pattern the regular expression and replacement the new text, which can insert capturing groups as $1, $2 and so on. occurrence 0 or omitted replaces every match, a positive number only that match, and a negative number that match counted from the end. case_sensitivity 0 or omitted matches case-sensitively and 1 ignores case. An invalid pattern returns #VALUE!.
Syntax
REGEXREPLACE(text, pattern, replacement, occurrence, case_sensitivity)
Category: Text. Minimum arguments: 3. Maximum arguments: 5.
Available for supported offline calculation.
Examples
=REGEXREPLACE("A1 B2","[0-9]","X")
The formula returns AX BX.
Cell and range examples require appropriate input values in the referenced cells. Handle invalid arguments, formula errors and array and spill constraints.