I need a Perl match expression that will succeed if the passed string matches a particular format, excluding some combinations. For example I need a match expression for filenames that don't start with an underscore and aren't "index.html " so someone can't upload those files to my site. I tried:
^[^_](ndex\.html){0} .*
which it would seem to me excludes anything starting with an underscore and anything with ?ndex.html matching 0 times (i.e. NOT matching?) but this seems to allow "index.html ".
Once I get the above working I need to extend it to dissallow files starting with "Icon" and "Thumb" for similar reasons.
Dominique
^[^_](ndex\.html){0} .*
which it would seem to me excludes anything starting with an underscore and anything with ?ndex.html matching 0 times (i.e. NOT matching?) but this seems to allow "index.html ".
Once I get the above working I need to extend it to dissallow files starting with "Icon" and "Thumb" for similar reasons.
Dominique
Comment