要求字母或数字17位就行(字母不能包含I O Q) 但是不能连续相同17的字母或数字 哪位大神帮忙一下 谢谢
var repeatTest = /^([a-z0-9A-Z]{1})\1{16}$/;
var test = /^([a-hj-npr-z0-9A-HJ-NPR-Z]){17}$/;
最后写了两个,唉,就这吧,
我不会但想领你的币一用谢谢大哥
我不会但想领你的币一用谢谢大哥
(?!(\w)\1{17})[^IOQ]{17}
1个搞定没研究出来,2个的用下面的
var rx = /^[\da-hj-npr-z]{17}$/i, rxs = /^(\w)\1{16}$/;
alert(rx.test('11111111111111111') && !rxs.test('11111111111111111'))
alert(rx.test('12345678912345638') && !rxs.test('12345678912345638'))
(?!(\w)\1{17})[^ioqIOQ]{17}
连续数字和字母的还解决
好像都不对啊,不过还是很谢谢各位的热心帮忙,谢谢,
哥们。有答案了告诉一下我。谢谢。
class Test{
public static void main(String[] args){
String str = "twer11twer";
// String str = "aaaaaaaaaa";
String regex = "^[a-z0-9A-Z && [^ioqIOQ]]{10}$";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(str);
if(matcher.find()){
if(1 != str.replaceAll("([a-z])\1+", "$1").length()){
System.out.println(matcher.group());
}else{
System.out.println("repeated number Or character : "+str.replaceAll("([a-z0-9A-Z])\1+", "$1"));
}
}else{
System.out.println("not compile Or number is not ten...");
}
}
}