js string转regExp 发表评论 /string规则 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); 等同于: 阅读全文