$charpattern = '/[!@#$%^&*()+-_]/' ; // will match one occurrence of any symbol inside the []
$number_matches = preg_match_all($charpattern,$password,$dummy); // note: $dummy required but not used here
if($number_matches > 1)
{
echo 'Passwords are only allowed one special character.<br>';
}
else
{
echo 'password is fine<br>';
}
I need the above script to ignore numbers in the password, if i enter a password for example sns182t it then puts out the error message: "only one special character allowed in a password."