长度8 以上,大小写、数字,特殊字符至少3种
public static boolean passWordCheck(String passWord){ if (null==passWord||passWord.length()<8) { return false; } List<String> list = new ArrayList<String>(4); list.add(".*\\d+.*"); list.add(".*[a-z]+.*"); list.add(".*[A-Z]+.*"); list.add(".*[~!@#$%^&*()_+|<>,.?/:;'\\[\\]{}\"]+.*"); int count = 0; for (String string : list) { if (passWord.matches(string)) { count ++ ; } } if (count>=3) { return true; } return false; }
来源:https://www.cnblogs.com/yrjns/p/12553404.html