REPLACEALL
Syntax
REPLACEALL(<string>; <string with regular expression>[; <string with replacement>])
Description
Replaces each substring of this string that matches the given regular expression with the given replacement.
Datameer X tries to match the entire record without automatically adding ^ or $ to the regular expression. But if the record has multiple lines, then this must be accounted for with (?s) or line terminators.Â
There is a difference in expressions between the Formula Builder and the Formula Bar.
With the Formula Builder, if you are writing regular expressions, you can use normal syntax. A backslash (\) is used to separate each expression.
With the Formula Bar, if you are writing regular expressions, you need to include an extra backslash (\) between each expression. This extra backslash between expressions is due to Datameer X using the backslash as an escape character.
Examples
String | Regular expression | String with replacement | REPLACEALL returns |
---|---|---|---|
2 years, two years | (2|two) | 3 | 3 years, 3 years |
a b c | [ ]+ | - | a-b-c |
a b c | [ ]+ | null | abc |