RE: [PHP] regex for cleaning up username

From: Date: Sun, 22 Jul 2001 20:26:08 +0000
Subject: RE: [PHP] regex for cleaning up username
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-59089@lists.php.net to get a copy of this message
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 } >-----Original Message----- >From: Jack Dempsey [mailto:dabigdemp@hotmail.com] >Try searching for anything that's not a word character: >if(preg_match("/\W/",$mystring)) >that should return true if it matches anything except for a letter, >number, or _... Will likely switch to that syntax for brevity sake. >your regex didn't work because you didn't use /'s at the beginning and >end of your regex... caught this one after further review of the regex documentation

« previous php.general (#59089) next »