replacex
To replace the matches of a given regular expression with a given string in a given text
This function extends the replace()
function and gives you the possibility to search using regular expressions. This gives you significantly more options for analyzing text when searching.
By specifying an empty string as a replacement, you can remove unwanted characters from a text.
Tip: Use this function to clean up imported data that contains unwanted characters.
Using regular expressions might need some extra research. We recommend checking regular expressions on https://regex101.com/ (external link).
Syntax
replacex(string, string, string)
replacex(string, string, string, string)
Return
string
Examples
replacex(text, regex, replace)
To replace the matches of a given regular expression with "replace" in a given text.
replacex(PhoneNo, "\D", " ")
Result: Replaces all non-digits (\D = Digit = [0-9]) in the "PhoneNo" field with spaces.
replacex(myText, regex, flags, replace)
To replace the matches of a given regular expression with "replace" in a given text. Flags can be added to the regular expression.
replacex(MyText, "^ *", "g", "")
Result: Removes all leading spaces from the "MyText" text field.
See also
replace
, which replaces a pattern in a string with a given replace.