原文 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"]