Regex_Replace (string, regex, replacementex)

Result Type: Text

Definition: Returns string with every occurrence of regex replaced with replacementex. Regex is a regular expression. Replacementex is an expression whihc can contain metacharacters referring to the sequences matched in the regualr expression. This function calls through to the standard C++ regex_replace function using the default regex mode.

Examples:  Regex_Replace("Quick brown fox", "a|e|i|o|u", "[$0]")

returns “Q[u][i]ck br[o]wn f[o]x”.

Availability:  v8.1.7 and later.

Warning:  Some people, when confronted with a problem, think "I know, I'll use regular expressions". Now they have two problems —Jamie Zawinski (attributed)

If you just want a simple (non-expression) text replacement, see Replace

See Also:

Dice: Get a subcomponent of a delimited tabular string

Head: Get some elements from the start of a delimited string

Left: Get characters from the start of a string

Mid: Get characters from the middle of a string

Regex_Match: Test whether a string matches a regular expression

Regex_Search: Find the first match of a regular expression in a string

Replace: Replace matching text in a string with new text

Right: Get characters from the end of a string

Slice: Get a component of a delimited string

Tail: Get some elements from the end of a delimited string

Trim: Remove whitespace from beginning and end of a string