var txt = "12312131283",
str = txt.replace(/(12(.3))/g,"中文$2");//$1是针对前面的扑获组()的如果有两个()就有$1和$2;中文$2就是中文加个获取的捕获组(.3)
console.log(str);
var txt = "12312131283",
str = txt.replace(/(12(.3))/g,"中文$2");//$1是针对前面的扑获组()的如果有两个()就有$1和$2;中文$2就是中文加个获取的捕获组(.3)
console.log(str);
转载于:https://www.cnblogs.com/xupeiyu/p/4805026.html