I am using the below script to check my passwords for length, uppercase, lowercase and numbers.
How could I change it to make it check FOR symbols instead of against
Tests if the input consists of 6 or more ASCII characters.The input must contain at least one upper case letter, one lower case letter and one digit.
if(preg_match('/\A(?=[\x20-\x7E]*?[A-Z])(?=[\x20-\x7E]*?[a-z])(?=[\x20-\x7E]*?[0-9])[\x20-\x7E]{6,}\z/' $password))
echo("valid password");
your desired regex is below
$pattern = ' ^.*(?=.{7,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$ ';
preg_match($pattern,$password);
Either you determine a list of valid symbols:
preg_match('`[\$\*\.,+\-=@]`',$password)
or you can look for anything that isn't alnum:
preg_match('`[^0-9a-zA-Z]`',$password)