@mangoohohoho match是匹配为数组,如果过滤字母:'a1b2c3d4e5'.replace(/(\w)(\d)/g, function(match, g1, g2, index, origin){
console.log(match);
return g2; //此处是match,删掉所有字母
});
输出:"a1"
"b2"
"c3"
"d4"
"e5"
"12345"
console.log(match);
return g2; //此处是match,删掉所有字母
});
输出:"a1"
"b2"
"c3"
"d4"
"e5"
"12345"
2018-01-18