var b="abeeee:eeeee:eeeeeab";
console.log(b.match(/e+\:e+/g));//["eeee:eeeee"]贪婪模式,只显示第一个匹配到的
console.log(b.match(/e+?\:e+?/g));//["eeee:e", "eeee:e"]非贪婪模式,从前向后查询
console.log(b.match(/e+\:(?=e+)/g));//["eeee:", "eeeee:"]
console.log(b.match(/e+?\:(?=e+)/g));//["eeee:", "eeeee:"]
console.log(b.match(/(?<=e+)?\:(?=e+)/g));//[":", ":"]
console.log(b.match(/e+?\:(?!e+)/g));//null
console.log(b.match(/(?:e+)?\:(?:e+?)/g));//["eeee:e", "eeee:e"]
相关文章
- 09-25js正则中的贪婪和非贪婪模式问题总结