* Thus wrote Luis Lebron ([EMAIL PROTECTED]): > I found a reqular expresion that I'm using to check for valid characters in > file names. > > Here's the sample code: > > if(preg_match("[^a-zA-Z0-9,._\+\()\-]",$filename)) > { > //blah, blah, blah > }
preg_* need a pattern deliminater (most commonly /,#, or !) so it should be: preg_match("/[^a-zA-Z0-9,._\+\()\-]/",$filename) Now you can get rid of all the escapes because mosts characters loose their special meaning inside a character class: preg_match("/[^a-zA-Z0-9,._+()-]/",$filename) You can get away without escaping the '-' because it *can't* be considered a range of characters since it is last (or if its first). That should work. Curt -- "My PHP key is worn out" PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php