1.匹配url参数 var re = /([^&=]+)=?([^&]*)/g while (r = re.exec("aaa1a=aabbbbbbb")) { alert(r); } 2.去重复 var ss = "Is is the cost of of gasoline going up up?.\n"; var re = /\b([a-z]+) \1\b/gim; // 创建正则表达式样式. while (r = re.exec(ss)) {…
js 正则 以字母开头必须有 大小写字母数字组成 可以有“@"或 ”.“ var reg = /^[a-zA-Z]{1}(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d_@\.]{6,16}$/; var v = reg.test(str); alert(v); //校验是否全由数字组成 function isDigit(s) { var patrn=/^[0-9]{1,20}$/; if (!patrn.exec(s)) return false return tr…