I have the following function
public function alpha_custom($str) {
return (! preg_match("/^([-a-z0-9_-])+$/i", $str)) ? FALSE : TRUE;
}
So, if the string contains anything other than alphanumeric characters, underscores or dashes, then it will return false.
Now I want to add the following:
SPACE&(AND).(period )
Please help me.
Thanks.
return (preg_match('/[^a-z_\(\)\.\&\ \-0-9]/i', $str)) ? FALSE : TRUE;EDIT
I have used this to check and it worked for me