日期:2014-05-16 浏览次数:20399 次
function test() { var arrstr = ['http://www.test.com/landing?m=xx&u=xx&t=xx', 'http://www.test.com/landing?u=xx&m=xx&t=xx', 'http://www.test.com?u=xx&m=xx&t=xx', '123.12.23.23?t=xx&m=xx&u=xx']; var reg = /^.+?\?(?:[tum][^&]+?&){2}[tum].+/g; for (var i = 0; i < arrstr.length; i++) { var str = arrstr[i]; document.write(str.match(reg)+"<br/>"); } }
------解决方案--------------------
var reg=/^(https?:\/\/)?.+?\?[mut]=.+(&[mut]=.+){2}$/;