Hi,
I am working on some form validation right now and I have a function that is called to check for certain characters and throw out errors if there is anything amiss. The problem I am having is trying to add comma and full stop to the list of what is acceptable, here is the code as it stands:
# a hash array of "types of data" pointing to "regexps" used to validate the data:
$data_types=array(
"email"=>$email_regexp,
"digit"=>"^[0-9]$",
"number"=>"^[0-9]+$",
"alpha"=>"^[a-zA-Z]+$",
"alpha_space"=>"^[a-zA-Z ]+$",
"alphanumeric"=>"^[a-zA-Z0-9]+$",
"alphanumeric_space"=>"^[a-zA-Z0-9 ]+$",
"string"=>""
);
Under alphanumeric_space I have tried to add: ,. but unfortunately this does not work like so:
"alphanumeric_space"=>"^[a-zA-Z0-9 ,.]+$",
I have also tried:
"alphanumeric_space"=>"^[a-zA-Z0-9 \,\.]+$",
But to no avail...
How can I make this work?
Thanks,
G