Re: regex for cleaning up username
| From: | CC Zona | Date: | Sun, 22 Jul 2001 21:48:00 +0000 |
| Subject: | Re: regex for cleaning up username | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-59094@lists.php.net to get a copy of this message | ||
In article <DBEIKNMKGOBGNDHAAKGNIEOAHBAA.dave@nexusinternetsolutions.net>,
dave@nexusinternetsolutions.net (Dave) wrote:
> Am partially successfull after taking a further look into things. the
> following
> (while ugnly) correctly catches everything except the \ character for some
> reason. ideas?
>
> if(preg_match("/['".'" ,!@#$%\^&*()+=\/\\:;?|]/',$MyString)){
> # echo error, character found
> }
Try four backslashes instead of two:
preg_match("/['".'" ,!@#$%\^&*()+=\/\\\\:;?|]/',$MyString)
--
CC