原文 https://blog.csdn.net/qq_38111015/article/details/80416823



var
s = 'CN_11223sgsg-dsg23.mtl' var matchReg = /(?<=CN_).*?(?=.mtl)/; s.match(matchReg)

 

(?=)会作为匹配校验,但不会出现在匹配结果字符串里面

(?:)会作为匹配校验,并出现在匹配结果字符里面,

var data = 'windows 98 is ok';
data.match(/windows (?=\d+)/);  // ["windows "]
data.match(/windows (?:\d+)/);  // ["windows 98"]
data.match(/windows (\d+)/);    // ["windows 98", "98"]

 

相关文章:

  • 2022-12-23
  • 1970-01-01
  • 2022-12-23
  • 2023-03-09
  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
相关资源
相似解决方案