Summary
Char()
Concat()
Format()
IndexOf()
Length()
Lowercase()
Propercase()
RegExMatch()
ReplaceList()
Replace()
Substring()
StringToHex()
Trim()
Uppercase()
Replaces every occurrence of one substring with a different substring.
| Marketing Cloud Engagement | ✅ Yes |
| Marketing Cloud Next | ✅ Yes |
This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0).
1Replace(sourceString,
2 searchSubstring,
3 replacementSubstring)The Replace() function has three parameters:
sourceString (string): Required. The string to search.searchSubstring (string): Required. The string to locate in sourceString.replacementSubstring (string): Required. The string to replace searchSubstring with.This example uses the RegExMatch() function to identify a piece of text (in this case, the names of the seasons) in a source string. It then uses the Replace() function to replace the name of the season in the source string with the current season.
1%%[
2 Var @sourceText, @regex, @regexMatch, @currentSeason, @promoText
3 Set @sourceText = "Special winter offers just for you!"
4 Set @regex = "(?:fall|winter|spring|summer)"
5 Set @regexMatch = RegExMatch(@sourceText, @regex, 0)
6 Set @currentSeason = "spring"
7 Set @promoText = Replace(@sourceText, @regexMatch, @currentSeason)
8]%%
9<p>%%=v(@promoText)=%%</p>The example returns the promotional message with the string “winter” replaced with “spring.”
1Special spring offers just for you!