/string规则
var str = ‘(//|.)ubmcmm.baidustatic.com’;
var str = ‘(//|.)ubmcmm.baidustatic.com’;
var rule = new RegExp(str, “”);
var res = rule.test(“http://ubmcmm.baidustatic.com/ad/flash/20113/9832732948023.swf“);
alert(res);
等同于:
//reg规则
var res = /(\/\/|\.)ubmcmm\.baidustatic\.com/.test(“http://ubmcmm.baidustatic.com/ad/flash/20113/9832732948023.swf“);
alert(res);