Skip to main content

replaceAll (Function)

Finds all the substrings of the input string that matches with the given expression, and replaces them with the given replacement string.

Syntax

<STRING> str:replaceAll(<STRING> input.string, <STRING> regex, <STRING> replacement.string)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
input.stringThe input string to be replaced.STRINGNoYes
regexThe regular expression to be matched with the input string.STRINGNoYes
replacement.stringThe string with which each substring that matches the given expression should be replaced.STRINGNoYes

Example 1

replaceAll("hello hi hello",  'hello', 'test')

This returns a string after replacing the substrings of the input string with the replacement string. In this scenario, the output is "test hi test" .