⌨ Syntax
REGEXREPLACE(text,pattern,replacement,[occurrence],[case_sensitivity])
Arguments
text
(required)
— The text or the reference to a cell containing the text you want to replace strings within.
pattern
(required)
— The regular expression ("regex") that describes the pattern of text you want to replace.
replacement
(required)
— The text you want to replace instances of pattern .
occurrence
(required)
— Specifies which instance of the pattern you want to replace. By default, occurrence is 0, which replaces all instances. A negative number replaces that instance, searching from the end.
case_sensitivity
(required)
— Determines whether the match is case-sensitive. By default, the match is case-sensitive. Enter one of the following: 0: Case sensitive 1: Case insensitive
▶ Examples
=REGEXREPLACE(A2,"[0-9]+-","***-")
=REGEXREPLACE(A2,"([A-Z][a-z]+)([A-Z][a-z]+)","$2, $1")