日期:2014-05-16 浏览次数:20382 次
var className='123a'; var reClass = new RegExp("(//s|^)" + className + "($|//s)"); var s='//s123a/s'; var s1='//s123a//s'; var s2='//s123a'; alert(reClass.test(s)); //false alert(reClass.test(s1)); //true alert(reClass.test(s2)); //true