For what it's worth, "..." is indeed a valid filename. Back in
Ancient Days of Yore, when I was a young undergrad at UC Santa Cruz
playing on the open-access timeshare Unix system, we all had read
access to each others' home directories, and it was somewhat common
for people to put semi-secret stuff in a directory "..." and mark it
readable/searchable by the user only. The name gave no indication of
what was actually in there, and if you did "ls -a", it was easily
overlooked next to "." and "..", which is a really pathetic form of
security by obscurity but better than nothing, especially in 1989.
So unless you have made a decision that you want to exclude files or
directories that are "..." and "...." and ".............", you need
to not just block everything that's made up entirely of periods.
Somebody sent in something just now saying that the regular
expression posted had to start with a period. That's not true. The
expression posted was
[^.]
Because it's in brackets, this is a character class. See "Using
character classes" in the perlretut manpage ("perldoc perlretut").
Within a character class, "^" doesn't mean "start", it means
"negated character class." From perlretut:
The special character "^" in the first position of a character
class denotes a negated character class, which matches any
character but those in the brackets.
And, within a character class, "." doesn't have its other meaning for
"any character but newline (unless you've used the s modifier, in
which case it matches that too)," but instead is an ordinary
character signifying itself.
So [^.] matches a string that has at least one character that's not a
period in it.
.abc
abc.def
abc....
abc
all match because the character class finds the first "a" in each
string, and that's a character other than a period. But
...
does not match, because the character class can't find anything
that's not a period in it. Similarly, "....." and ".........." won't
match.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>