preg_match pattern.
Posted: Mon Jul 16, 2007 8:02 am
Hi. I'm having some problems with a method that checks names (e.g First name, Last name) with preg_match(). The pattern I'm using now is ([[:digit:]]|[~`!@#$%^*()_=+{}|\:;"/?,]|[|]|)+';//#^_+=:;()[]<>{}%#$?!\\/0-9]$/';. I'm trying to look for invalid characters but something is wrong because it always return false.
Method:
Thanks for any help 
Method:
Code: Select all
function check_text($field_text)
{
$pattern = '([[:digit:]]|[~`!@#$%^*()_=+{}|\:;"/?,]|[|]|)+';
if(preg_match($pattern,$field_text))
{
return true;
}
return false;
}