> but it's a one-liner

So?

Unless you have a limited number of newlines, mindlessly shoving commands into 
a single line is really dumb; it reduces readability and achieves nothing.

This is another thing that bugs me - people compressing code without thought - 
having the right amount of whitespace in the right places is good for you!



> takes care of . inside filenames and any file extension length

Well yeah, the original spec was dealing with images, which in general have a 
limited set of extensions, so extension length wasn't so much an issue.

But yes, something to work for all filenames could be useful to people.

All the ones you gave, (aside from being /UGLY/ :P), will not work for several 
common filenames - try running ".htaccess" and "README" through them, for 
example.

Of course, I have come up with a one-line solution, but not by shunting 
together multiple commands. :P

FileName = rereplace( FileName , '(?!\.[^.]*$)\W' , '' , 'all' )

Strips all non-word characters, excluding the final dot (if any).



Although, thinking a bit more... for general purpose use, I might not bother 
stripping dots, or hyphens, or tilde, so might end up with this instead:

FileName = rereplace( FileName , '(?!\.[^.]|[-~])\W' , '' , 'all' )



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316730
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to