ErgExp-lookbehind assert(后行断言)
时间:2020-01-24 00:14:44
收藏:0
阅读:121
//先行断言:先遇到一个条件,判断后面的条件是否满足 let test = ‘hello world‘ console.log(test.match(/hello(?=\sworld)/)) //后行断言 //判断world的前面是不是hello console.log(test.match(/(?<=hello\s)world/)) //匹配world前面不是hello的 console.log(test.match(/(?<!hells\s)world/))
原文:https://www.cnblogs.com/qjb2404/p/12231726.html
评论(0)