let str = “one two three”;
let fixRegex = /(\w+)\s(\w+)\s(\w+)/; // Change this line
let replaceText = “$3 $2 $1”; // Change this line
let result = str.replace(fixRegex, replaceText);
What I don’t understand is how “$3 $2 $1” is able to work. Does $ just automatically refer back to the regex being used in the replace function? What if you wanted to replace with the literal string that contained the dollar sign? i.e “$4 $6 $1”