replace
To replace a pattern in a string with a given replace
This function allows you a simple search & replace as you know it from a word processing program: You search in a text for a certain string. As soon as this is found, it is replaced by another string.
Both strings can have different lengths and can contain any representable character. By specifying an empty string as "replace" you can remove unwanted characters from a text.
The search differentiates between upper and lower case letters.
Tip: You can also use this function to set specially marked placeholders within text fields. You can then replace these with personalized content, for example when printing or sending e-mails.
Syntax
replace(string, string, string)
Return
string
Examples
replace(myText, pattern, replace)
To replace a pattern in a given string with a given replace.
Result: Hella warld! (each occurring "o" is replaced by an "a". Doesn't make sense, but we just wanted to show you how it works 🤓).
Result: From the MyText text field, all double spaces are replaced by one space.
Result: The placeholder string "##FNAME##" is replaced by the content of the data field/variable "First name", e.g.:
Hello Jimmy!
See also
replacex
, which replaces the matches of a given regular expression with a given string in a given text.
Last updated