a1exlism
12/3/2016 - 12:47 PM

js_regexp_$n.js

var str = '1234qwer';
newStr = str.replace(/(1234)(qwer)/, '$24321');
console.log(RegExp.$1); //  4321qwer
console.log(RegExp.$2); //  qwer
console.log(newStr);    //qwer4321