为什么我无法抓取子图案?undefined
当我期望hello
输出时,控制台显示。如果我改变matches[1]
了matches[0]
我会得到{{hello}}
。那么,为什么我不能访问该子模式?
var str = "{{hello}}";
var matches = str.match(/{{(.+)}}/ig);
console.log(matches[1]);
尝试:
str.match(/{{(.+)}}/i);
代替。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句