字符串方法match()中正则表达式全局的匹配结果
var reg4=/\d(\w)\d/g; var str="1a2b3c4d"; console.log(str.match(reg4));
这段代码运行的结果是:["1a2","3c4"];
为什么不是["1a2","2c3","3c4"];
var reg4=/\d(\w)\d/g; var str="1a2b3c4d"; console.log(str.match(reg4));
这段代码运行的结果是:["1a2","3c4"];
为什么不是["1a2","2c3","3c4"];
2018-11-10
举报