ReplaceList()

Replaces one or more substrings with another string.

Availability

<table> <tr> <td>Marketing Cloud Engagement</td> <td>✅ Yes</td> </tr> <tr> <td>Marketing Cloud Next</td> <td>✅ Yes</td> </tr> </table>

This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0).

Syntax

ReplaceList(sourceString, replacementString,
            searchString1, [searchString2], ...)

The ReplaceList() function has three parameters:

  • sourceString (string): Required. The string to search.
  • replacementString (string): Required. The replacement string.
  • searchString1 (string): Required. The string to find.

You can search for more than one substring by appending additional parameters. You can add as many search strings as necessary.

Usage

This example removes delimiting characters (|, ;, and ,) from a string of text. It replaces the delimiters with a string of text that makes the complete list easier to read.

%%[
  Var @hobbies, @hobbiesList
  Set @hobbies = "biking|cooking;travel,gardening"
  Set @hobbiesList = ReplaceList(@hobbies,
                                 ", ", /* Replacement string */
                                 "|", ";", ",") /* Delimiters */
]%%
<p>Your favorite hobbies are: %%=v(@hobbiesList)=%%.</p>

The function returns a string in which the delimiting characters have been replaced with the replacement string.

Your favorite hobbies are: biking, cooking, travel, gardening.