expanding on @TimPietzcker and he should take all credit. So be sure to upvote his answer. But I needed this:
no triple repeated characters
no triple incremental characters / digits
because double incremental characters is odd, you won't even notice you did it.
E.g. test4x3x6 should work right? wrong, st
is an incremental character. This will just drive your users crazy.
So I used this:
function is_password_strong($password){
$preg_res = preg_match(
'%^ # Start of string
(?!.*(.)\1{2}) # Assert no triple repeated characters
# Assert no sequential digits/characters
(?!.*(?:012|123|234|345|456|567|678|789|890|
abc|bcd|cde|def|efg|fgh|ghi|hij|ijk|jkl|
klm|lmn|mno|nop|opq|pqr|qrs|rst|stu|tuv|
uvw|vwx|wxy|xyz))
.{8,} # Match at least 8 characters
$ # End of string%ix',
$password);
if ($preg_res) {
return true;
}else{
return false;
}
}