对JS中正则表达式中“|”的使用存在疑惑,见下面代码:let str = "your cat's belly is fat";let reg = /(fat|belly|is)/g;console.log(str.match(reg)); // ["belly", "is", "fat"]返回的结果为何不是["fat", "belly", "is"]?请懂正则引擎的大神们指教!
添加回答
举报
0/150
提交
取消