I have the following code block for validation in PHP and I can't figure out why my validation is still failing. I am a newbie to regular expressions but I want to allow for ($ , . -) but it isn't working. I started out with "[A-Za-z0-9]". The only character that is allowed with the below code is the dash (-) but not $ or . or , or space. Can someone point me in the right direction?
case 'alnum':
{
$bret= $this->test_datatype($input_value,"[A-Za-z0-9\s$,.-]");
if(false == $bret) {
$default_error_message = sprintf(E_VAL_ALNUM_CHECK_FAILED,$variable_name);
}
break;
}
preg_matchright there and not obfuscate it with an interception method. (Which, its inner workings being unknown, makes this hard to answer). Thefalse==comparison is also super redundant.