标签:print abc test 密码 oid stat pre NPU 特殊
大小写字母,数字,特殊字符中的至少3种.8位以上,正确返回true
public static boolean rexCheckPassword(String input) {
// 8-20 位,字母、数字、字符
String regStr = "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W_]+$)(?![a-z0-9]+$)(?![a-z\\W_]+$)(?![0-9\\W_]+$)[a-zA-Z0-9\\W_]{8,20}$";
return input.matches(regStr);
}
@Test
public static void main(String[] args){
System.out.println(rexCheckPassword("abcd"));
System.out.println(rexCheckPassword("abcd1234"));
System.out.println(rexCheckPassword("abcd1234#"));
System.out.println(rexCheckPassword("Abcd1234"));
System.out.println(rexCheckPassword("Abcd#$%"));
}}
标签:print abc test 密码 oid stat pre NPU 特殊
原文地址:https://www.cnblogs.com/cqbstyx/p/11063278.html