📅  最后修改于: 2022-03-11 15:04:05.929000             🧑  作者: Mango
console.log(("str1,str2,str3,str4".match(/,/g) || []).length); //logs 3
console.log(("str1,str2,str3,str4".match(new RegExp("str", "g")) || []).length); //logs 4