Replace()

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).

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.

The example returns the promotional message with the string “winter” replaced with “spring.”