The replace filter replaces string parts.
{{ "I like this and that."|replace({'this': 'chocolate', 'that': 'candy'}) }}
Result
I like chocolate and candy.
Please note that if the very same string part is provided as a value first, then a key in the parameter, it will become overwritten. In this example, you can see that "cats" changes to "dogs" first, then both "dogs" change to "birds".
{{ "I like cats and dogs."|replace({'cats': 'dogs', 'dogs': 'birds'}) }}
Result
I like birds and birds.
Important: the replace filter cannot handle ESL expressions without a result (the content before the pipeline character in the example). Message including these are not sent out and they increase the No content metric.