I have the following Regex to allow alphanumeric characters and following special characters
/()-
The Regular expression is
/[^A-Za-z0-9-()-/]/
The complete method is
public function ValidateNumber($number)
{
$return = true;
$matches = null;
if((preg_match('/[^A-Za-z0-9-/()-]/', $number, $matches)) > 0)
{
$return = false;
}
return $return;
}
Above method woks fine, but also return TRUE if number has space. When i remove '/' from Regex then if number has 'space' in it then it returns FALSE.
So seems some issue with '/' in Regex.
Please advise some solution