ErgExp-lookbehind assert(后行断言)

Posted qjb2404

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ErgExp-lookbehind assert(后行断言)相关的知识,希望对你有一定的参考价值。

//先行断言:先遇到一个条件,判断后面的条件是否满足
let test = ‘hello world‘
console.log(test.match(/hello(?=sworld)/))

//后行断言
//判断world的前面是不是hello
console.log(test.match(/(?<=hellos)world/))
//匹配world前面不是hello的
console.log(test.match(/(?<!hellss)world/))

 

以上是关于ErgExp-lookbehind assert(后行断言)的主要内容,如果未能解决你的问题,请参考以下文章