if(preg_match(\'/[^a-z\\-0-9]/i\', $value))
{
echo \"\";
}
how
The hyphen
doesn't need to be escaped if it's the first or last in the character class.
The dot
also doesn't need to escaped when used inside a character class []
i.e.:
/[^a-z.0-9-]/i
NOTES:
Apart from the above, the meta characters that also need to be escaped inside a character class are:
^ (negation)
- (range)
] (end of the class)
\ (escape char)