1
$password = 'pwd3000!';
if(!preg_match('/^(?=.{4,31}$)(?!.*(.)\1{4}). \w[\w.-]+\w$/', $password)){
echo 'Your password is too easy';
} else {
echo 'Your password is strong';
}
如果密码有4个以上重复字符,我想回显'您的密码太简单了'。防止在密码中重复字符
现在,当我运行代码时,我得到'您的密码太简单了'。但它只有3个重复的字符串,而不是4.我该如何解决这个问题?
可能dublicate http://stackoverflow.com/questions/20770148/how-to-prevent-the-user-from-repeating -a-character-more-three-times-in-the –
过滤出重复的字符或*连续的*重复的字符? – castis
@castis连续 – brewpixels