弱密码校验

public static void main(String[] args) {
        String match = "^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!#$%^&*])[\da-zA-Z!#$%^&*]{8,16}$";
        String password = "123";
        boolean matches = password.matches(match);
        System.out.println(matches);
    }

8-16位弱密码校验
^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!#$%^&*])[\da-zA-Z!#$%^&*]{8,16}$

密码要求不少于8个字符,包含大写字母、小写字母、数字或特殊符号

String regex = "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W_]+$)(?![a-z0-9]+$)(?![a-z\\W_]+$)(?![0-9\\W_]+$)[a-zA-Z0-9\\W_]{8,}$";

你可能感兴趣的:(java,前端,开发语言,弱密码校验)