replace()替换文字扑获组做法
时间:2015-09-13 15:58:59
收藏:0
阅读:196
var txt = "12312131283",
str = txt.replace(/(12(.3))/g,"中文$2");//$1是针对前面的扑获组()的如果有两个()就有$1和$2;中文$2就是中文加个获取的捕获组(.3)
console.log(str);
原文:http://www.cnblogs.com/xupeiyu/p/4805026.html
评论(0)