今日起工作学习中做些记录
方法一
var text="cat,bat,sat,fat";
var pattern=/.at/g;
var matches;
while(pattern.lastIndex<text.length){
matches=pattern.exec(text);
console.log(matches);
console.log(pattern.lastIndex);
}
方法二
var str="cat,bat,sat,fat";
var pattern=/.at/g;
var matches=str.match(pattern);
matches