mfinocc
asked on
PHP preg_match
I need to validate a string for these criteria...
Must be 5 characters
First 4 characters must be 0-9
Fifth character must be A-Z
How do I make this work?
$name = test_input($_POST["name"]) ;
if (!preg_match("/^[0-9] {4} [A-Z] {1}$/",$name)) {
$nameErr = "not allowed";
}
Must be 5 characters
First 4 characters must be 0-9
Fifth character must be A-Z
How do I make this work?
$name = test_input($_POST["name"])
if (!preg_match("/^[0-9] {4} [A-Z] {1}$/",$name)) {
$nameErr = "not allowed";
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!
Open in new window