php判断密码强度的一个小正则,字母、数字、符号任意两种匹配

//最少8位字符,包含字母,数字,符号中的任意两项
private function check_strong($pwd)
{
    if(strlen($pwd)<8){
        return [];
    }
    $preg = "/^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)]|[\(\)])+$)([^(0-9a-zA-Z)]|[\(\)]|[a-z]|[A-Z]|[0-9]){6,}$/";

    preg_match_all($preg, $pwd, $res);

    return $res[0];
}


评论/留言