Skip to Content

REGEXREPLACE

Replaces strings within the provided text that match a regular expression pattern with a replacement string

Syntax

REGEXREPLACE(text, pattern, replacement, [occurrence], [case_sensitivity])

Parameters

  • text: Required. The text in which to replace matches
  • pattern: Required. The regular expression pattern to match
  • replacement: Required. The replacement text
  • occurrence: Optional. Which occurrence to replace (0=all, 1=first, etc. Default is 0)
  • case_sensitivity: Optional. 0=case-sensitive (default), 1=case-insensitive

Example

=REGEXREPLACE("Hello 123 World 456", "[0-9]+", "#")
Returns: StringSince: Microsoft 365