Today at 10:10am, QuickBrownFox said:

>I'm no regexp guru, but I think something like the following would work:
>
>"^[^.]$"
>
>I believe, since the "." is inside the character class, it doesn't have
>the "match any character" special meaning.  If I'm wrong, you'd have to
>escape it with a "\".

Right, you need to escape it. The only other thing is that as written, it
will only match a single character. If you add a * or a + after the ] then
it will match a whole string. Same applies to the regexp below.

>The only problem is that this regexp will match
>non-printing characters as well.  Perhaps you'd be better off to
>explicitly declare the characters you want to allow in the file name,
>something like this:
>
>"^[-a-zA-Z0-9_]$"

Again, another good idea. In general, for better security, when checking
your strings for "invalid characters" it is best to make sure they contain
only characters from the good list, rather than checking to make sure they
don't have any characters on the bad list. It is really easy for your bad
list to be incomplete, and leave holes for people to do stuff you hadn't
intended.

Mac

--
Mac Newbold             MNE - Mac Newbold Enterprises, LLC
[EMAIL PROTECTED]       http://www.macnewbold.com/

____________________
BYU Unix Users Group 
http://uug.byu.edu/ 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to