\.exe isn't same as \.EXE

Tips on writing regular expressions for searching the post list

Moderators: Quade, dexter

\.exe isn't same as \.EXE

Postby Vanguard » Mon Aug 11, 2003 1:37 pm

I was wondering some of the files that I was supposed to be rejecting were still getting accepted. Then I realized that the filenames were capitalized. I went back into the Subject and File filters and found that I could enter lower- and upper-case versions of each expression, as in:

\.exe
\.EXE
\.ht(m|ml)
\.HT(M|ML)
\.vbs
\.VBS

So are the regular expressions case sensitive (in how they get applied in filtering in/out strings and filenames)? I have a list of about 30 expressions to reject certain strings or files. If they are case sensitive then this list will double to 60 expressions. And, of course, if I were to cover every permutation of lower- and upper-case characters then I would have several hundred expressions, like:

\.exe
\.exE
\.eXe
\.eXE
\.Exe
\.ExE
\.EXe
\.EXE

or more simply:

\.[eE][xX][eE]

and the one for rejecting HTML files would become:

\.[hH][tT]([mM]|[mM][lL])

or maybe this might work:

\.[hH][tT]([mM][lL]?)

The expressions get a lot more complicated if I also have to take in account capitalization.
Vanguard
n00b
n00b
 
Posts: 4
Joined: Tue Jul 01, 2003 10:15 am

Postby Smite » Mon Aug 11, 2003 2:51 pm

\.[hH][tT]([mM][lL]?)


This should work, but I'm not sure I see the need for the brakets.
User avatar
Smite
Katamari Damacy Addict
 
Posts: 5318
Joined: Sat May 19, 2001 1:54 am
Location: Alberta, Canada

Registered Newsbin User since: 03/27/03


Return to Regular Expressions

Who is online

Users browsing this forum: No registered users and 26 guests