侧边栏壁纸
  • 累计撰写 197 篇文章
  • 累计收到 496 条评论

JavaScript中的先行断言与后行断言

2019-11-12 / 0 评论 / 39 阅读
let test = 'hello world'
// 后行断言
let res = test.match(/hello(?=\sworld)/)

console.log(res)

// 先行断言
res = test.match(/(?<=hello\s)world/)

console.log(res)

评论一下?

OωO
取消