Snetty
07-14-2008, 11:54 AM
I'm trying to write a regular expression that validates a form entry. It's designed to only allow uppercase alphabetic characters and numbers, it must also be between 2 and 4 characters in length (inclusive).
I came up with the following.. but it's allowing pretty much everything through, can anyone see where I'm going wrong?
if(preg_match('/^([A-Z0-9]{2,4})$/', $_POST['prefix']) === FALSE){ fail }
Any help much appreciated.
I came up with the following.. but it's allowing pretty much everything through, can anyone see where I'm going wrong?
if(preg_match('/^([A-Z0-9]{2,4})$/', $_POST['prefix']) === FALSE){ fail }
Any help much appreciated.