Okay, I'm using the following code (where $password
= the post password variable). This is part of a large form validation code, and this line of code seems to trigger when it shouldn't. I'm afraid some part of it is deprecated. I've tried entering pass123A
, Password12
, and 1Password
, and they all trigger this code. Why?
elseif(preg_match("/^[a-zA-Z0-9]$/", $password) == 0)
echo('Error - the password can only contain alpha-numeric chars!');