1
我尝试检查字符串中给定的RegExp
规则,并需要获取当前的匹配规则。获取当前匹配的正则表达式规则
这里是我试过到目前为止:
var prefixes = /-webkit-|-khtml-|-moz-|-ms-|-o-/g;
var match;
var str = '';
while (!(match = prefixes.exec(str))) {
str += '-webkit-';
console.log(match); // => null
}
的match
是null
,但我怎么能得到的电流匹配规则(在这种情况下-webkit-
)?
MHH,不同样的工作:http://jsbin.com/abisim/1/edit – yckart