public static void main(String[] args) {
String[] pwds={"123456","1234567","12w2222","222ww","@wdss1","23ewW3","dse23WWFD2","%123aASD%","*%12W3asd%*","A123456","a1234567","Assssss","aAssssss","123456A","1234567a","ssssssA","sssSD3sss"
,"aaaaaaa","AAAAAAA","#######"};
System.out.println("至少1个大写字母,1个小写字母和1个数字,其他可以是任意字符");
for (String password:pwds){
boolean isMatch = password.matches("^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[\\s\\S]{6,16}$");
System.out.println(password+":"+isMatch);
}
System.out.println("至少1个字母和1个数字,其他可以是任意字符");
for (String password:pwds){
boolean isMatch = password.matches("^(?=.*[a-z|A-Z])(?=.*\\d)[\\s\\S]{6,16}$");
System.out.println(password+":"+isMatch);
}
System.out.println("2种组合,大小写或字母+数字,其他可以是任意字符");
for (String password:pwds){
boolean isMatch = password.matches("^(?=.*[a-z|A-Z])(?=.*[A-Z|\\d])(?=.*[a-z|\\d])[\\s\\S]{6,16}$");
System.out.println(password+":"+isMatch);
}
}
密码强度正则
最新推荐文章于 2023-12-29 16:42:00 发布
712

被折叠的 条评论
为什么被折叠?



