正则表达式 match test exec
//test 返回boolean ,match在/g时返回所有的结果,exec在上次结束时的位置开始匹配
let reg = /abc/;
let regg = /abc/g;
let str = "abcabcabc";
str.match(reg);
//["abc", index: 0, input: "abcabcabc", groups: undefined]
reg.exec(str);
//["abc", index: 0, input: "abcabcabc", groups: undefined]
reg.test(str);
//true
str.match(regg);
// ["abc", "abc", "abc"]
regg.exec(str);
//["abc", index: 0, input: "abcabcabc", groups: undefined]
regg.exec(str);
//["abc", index: 3, input: "abcabcabc", groups: undefined]