replaceAll
Last update: February 23, 2022
- Topics:
- Journeys
CREATED FOR:
- Experienced
- Developer
Replaces all occurrences matching the target string by the replacement string in the base string.
The replacement proceeds from the beginning of the string to the end, for example, replacing “aa” with “b” in the string “aaa” will result in “ba” rather than “ab”.
Category
String
Function syntax
replaceAll(<parameters>)
Parameters
Parameter | Type |
---|---|
base | string |
target | string (RegExp) |
replacement | string |
Signature and returned type
replaceAll(<baseString>,<sourceString>,<replacementString>)
Returns a string.
Example
replaceAll("Hello World", "l", "x")
Returns “Hexxo Worxd”.
Because the target parameter is a RegExp, depending on the string you want to replace, you may need to escape some characters. Refer to the example in this page.
Previous pagereplace
Next pagesplit
Journey Orchestration
- Product documentation
- What’s new
- Starting with Journey Orchestration
- Configuring an event
- Configuring a data source
- Configuring an action
- Using segments
- Building a journey
- Build expressions
- Building your reports
- Integrating with Intelligent Services
- Use cases
- Working with APIs