within my validation class i have this function:
public function alphanumeric($field, $value, $message=null)
{
if (!preg_match("/^[a-zA-Z0-9 -]+$/", $value))
{
$this->errors[] = array($field, $value, $message);
return 0;
}
else
{
return 1;
}
}
How would i go about allowing the field to also be blank? would i need to use and empty() check or can it be done via the regex?