我使用preg match验证密码为:
(preg_match("/^.*(?=.{5,}).*$/", $password)
也接受特殊字符。
但出于某种原因,我需要修改它应该接受
答案 0 :(得分:6)
if (preg_match(
'%^ # Start of string
(?!.*(.)\1) # Assert no repeated characters
# Assert no sequential digits/characters
(?!.*(?:01|12|23|34|45|56|67|78|89|90|
ab|bc|cd|de|ef|fg|gh|hi|ij|jk|
kl|lm|mn|no|op|pq|qr|rs|st|tu|
uv|vw|wx|xy|yz))
[a-z0-9]{5,} # Match at least five alnum characters
$ # End of string%ix',
$password)) {
# Successful match
}