$re = '/^ # 匹配行首
(?=.*[A-Z]) # 向前环视,匹配到大写字母
(?=.*[a-z]) # 向前环视,匹配到小写字母
(?=.*\d) # 向前环视,匹配到数字
(?=.*[_\W]) # 向前环视,匹配到特殊字符
.{10,} # 若满足以上环视条件,且有10个以上字 符,则进行匹配
$ # 匹配行尾/mx';
$str = '// Good Case
asdfsadfANVasdfasdfasdf..sadfs1
www.baidu.com.COM123
qwerTYUIOP1233333333333333
qwerTYUIOP1233333333333333-=+
asdfsafxxxSSS..123
abcABC123,./
// Bad Case
xxxyyyzzz
XYZxyz123
aaabbbccc
12342353125123asedf';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php