✘✘✘ Javascript

[javascript] replace with Regex, $n vs $&

PrettyLog 2023. 5. 9. 11:51

The $& and $1 are not the same.

$& is a back reference to the whole match.
$1 is a back reference to the submatch captured with capturing

ref