Simple check for 4 or 5 digits not working
Posted: Tue Nov 17, 2009 3:34 pm
Simple check for 4 or 5 digits not working
The code below allows more than 5 digits to be entered.
I am new to regex, any ideas ?, i thought {4,5} would ensure more than 5 digits is not
allowed ?
Thanks,
The code below allows more than 5 digits to be entered.
Code: Select all
if (!$error && !preg_match("/[0-9]{4,5}$/", trim($tel_prefix))) {
$error = true;
$message = "Telephone Prefix is 4/5 digits ";
$focus = "tel_prefix";
}
allowed ?
Thanks,