RE: reg exp to filter bad characters in filename
by "nik krimm" <nik(at)krimm.net>
|
Date: |
Wed, 5 Jun 2002 11:23:41 -0500 |
To: |
<hwg-languages(at)hwg.org> |
In-Reply-To: |
JEREMY |
|
todo: View
Thread,
Original
|
|
Not sure about Perl syntax (i use js regExp), but the special pattern '\w'
matches only letters, numbers, or underscores.
HTH.
-----Original Message-----
From: owner-hwg-languages(at)hwg.org [mailto:owner-hwg-languages(at)hwg.org]On
Behalf Of jeremy
Sent: Wednesday, June 05, 2002 10:15 AM
To: 'Richard Walker'; hwg-languages(at)hwg.org
Subject: RE: reg exp to filter bad characters in filename
I would also be interested in something like this. Unfortunately, all I
have gotten around to writing is renaming the file in case one with the
same name already exists.
Jeremy Brown
Director of Web Technology
Hafenbrack Marketing and Communications
http://www.hafenbrack.com
(937) 859-0730
-----Original Message-----
From: owner-hwg-languages(at)hwg.org [mailto:owner-hwg-languages(at)hwg.org]
On Behalf Of Richard Walker
Sent: Wednesday, June 05, 2002 10:35 AM
To: hwg-languages(at)hwg.org
Subject: reg exp to filter bad characters in filename
Yo
I wrote a PHP app to allow people to upload files. Immediately the
client
proceeds to upload files with all kinds of gunk in them, such as '+'
and ' '.
I need a reg exp to filter out everything but alphanumeric, ., and _
characters. I could do a nested if statement or something but I know
there's a nice terse Perl compatible solution.
Thanks!
--
Richard Walker
RichardWalker(at)onebox.com - email
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA