Home › Functions › Text › REGEXREPLACE
fx
REGEXREPLACE
Text  ·  Since: Microsoft 365  ·  9 languages

The REGEXREPLACE function allows you to replace text from a string with another string, based on a supplied regular expression ("regex").

🌐 Translations

English REGEXREPLACE
Deutsch REGEXREPLACE
Français REGEXREPLACE
Español REGEXREPLACE
Italiano REGEXREPLACE
Português REGEXREPLACE
Nederlands REGEXREPLACE
Polski REGEXREPLACE
Русский REGEXREPLACE

📦 Availability

Excel versionAvailable
Excel 2007 ✗
Excel 2013 ✗
Excel 2019 ✗
Excel 2021 ✗
Microsoft 365 ✓
Translate a formula with this function
fx EN
fx DE

⌨ 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")

Related functions

Copied to clipboard