Description

Perform a regular expression search and replace.
An optional parameter, flags, allows you to specify options on how the replacement is performed.
Supported format specifiers for replace parameter:
$number : Substitutes the substring matched by group number.
n must be an integer value designating a valid backreference, greater than 0, and of two digits at most.
${name} : Substitutes the substring matched by the named group name (a maximum of 32 characters).
$& : Substitutes a copy of the whole match.
$` : Substitutes all the text of the input string before the match.
$' : Substitutes all the text of the input string after the match.
$+ : Substitutes the last group that was captured.
$_ : Substitutes the entire input string.
$$ : Substitutes a literal "$".
As note, the character \ can be also used with format specifier, this is same hehavior as $.