JS: Regex Replace String Dollar Sign

By Xah Lee. Date: .

When using regex, the following dollar sign sequence have special meaning in the replace string.

This is used by:

$n
nth captured match. (n is a positive integer less than 100)
$<name>
refers to named capture name.
$&
the matched string.
$`
the string before the matched string.
$'
the string after the matched string.
$$
literal dollar sign character.

JavaScript, Regular Expression

BUY ΣJS JavaScript in Depth