regex_replace_all

The regex_replace_all method searches a string for matches to a regular expression, and replaces the matches according to the value specified by the replacement argument.

Syntax

regex_replace_all( input, regex, replacement )

Arguments

Argument Description
input (string) The string in which you want to replace values.
regex (string) The regular expression to use to find values to be replaced.
replacement (string) A string that specifies how to replace the matches of the regular expression.

Returns

(String). The modified string.

Examples

regex_replace_all("ABC ABC ABC", "AB", "A")
-- returns "AC AC AC"

regex_replace_all("One Two Three", "\\w{3}", "_")
-- returns "_ _ _ee"


regex_replace_all("One Two Three", "(\\w+) (\\w+)", "\\2 \\1")
-- returns "Two One Three"

_HP_HTML5_bannerTitle.htm