标签:javascript查找匹配 js match js regexp
/c/img.exec('abcdefgc'); //['c'] new RegExp("c","img").exec('abcdedgc'); //['c'] /c/img.exec('a'); //null示例2:
var reg = new RegExp("c","im"); reg.exec("abcabc"); //["c"] reg.lastIndex; //0 var reg = new RegExp("c","img"); reg.exec("abcabc"); //["c"] reg.lastIndex; //0 typeof reg; //"object" Object.prototype.toString.call(reg); //"[object RegExp]"(2)test 检索字符串中指定的值。返回 true 或 false。
/c/img.test('abcdefgc'); //true new RegExp("c","img").test('abcdedgc'); //true
标签:javascript查找匹配 js match js regexp
原文地址:http://blog.csdn.net/ligang2585116/article/details/45799457