public static void main(String[] args) {
boolean flag = true;
while (flag){
Scanner sc = new Scanner(System.in);
System.out.println("请输入密码:");
String s = sc.nextLine();
System.out.println("s = " + s);
//定义密码规则 包含大写小写字母数字的8到16位
String regex = "(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])\S{8,16}$";
//判断功能 匹配
boolean isMatch = s.matches(regex);
System.out.println("isMatch:" + isMatch);
flag = !s.matches(regex);
}
}



