As far as I know, you cannot achieve this because it is a complex scenario of conditions.
What you need to do is to do this in three ways:
$has8characters = (mb_strlen($_REQUEST['password']) >= 8);
$hasAlphaNum = preg_match('b[a-z0-9]+bi', $_REQUEST['password']);
$hasNonAlphaNum = preg_match('b[\!\@#$%\?&\*\(\)_\-\+=]+bi', $_REQUEST['password']);
This has not been verified, but you are pretty close to what you want to achieve with this ...
Good luck.
source
share