Hi, is there any preg_match only allow a-zA-Z0-9():[space] ? Please help me =(

Member Avatar

I'm no brain on regex, but I think this works, with limited testing...

$pattern = "/[A-Za-z0-9:() ]/";
$subject = "#How# #912# #:m:# #(@)# #-_-#";
$replace = "?";
$m = preg_replace($pattern,$replace,$subject);

echo $m;