Runtime verified Differs from official docs Test scripts included

Replaces every occurrence of a substring with another (case-sensitive).

Syntax

{{replace subject search replacement [culture]}}

Returns string.

Parameters

Name Type Required Description
subject string Yes String in which to replace text.
search string Yes The substring to search for.
replacement string Yes The replacement substring.
culture string No BCP 47 locale code for culture-specific comparison.

Example

Tested in a Marketing Cloud Next email on 2026-11-22:

  • {{replace "a-b-c" "-" "+"}} renders a+b+c, as documented.
  • {{replace "Aa" "a" "x"}} renders xx. The documented result is Ax.
Show Next test script
<!-- Marketing Cloud Next test script for the replace helper. Paste it into the HTML component of a
     Next email and open the preview. Each line prints the result Next gave when the call
     was rendered on its own (expect) next to the result of this run (got).
     Assembled from single-call test emails (dates on the page); it has not been
     run as one email. Calls that make Next fail are listed separately. -->
<p>c1 expect=[a+b+c] got=[{{replace "a-b-c" "-" "+"}}]</p>
<p>c2 expect=[xx] got=[{{replace "Aa" "a" "x"}}]</p>

Differs from official docs

  • The reference says the search string is matched case-sensitively. In Marketing Cloud Next (tested 2026-11-22): {{replace "Aa" "a" "x"}} rendered xx: the uppercase A was replaced too. A case-sensitive match would give Ax. Details

Marketing Cloud Next

See also