On Wednesday 05 December 2007 16:35, Steve Bertrand wrote:
> >
> > Why can't you just use file globbing in the shell:
> >
> > tar -c /[a-z]/200[24]
>
> I didn't even think that such a regex would work underneath such a
> command. Pardon my ignorance.
It is not a regex, it is a file glob.
man 7 glob
[ SNIP ]
WILDCARD MATCHING
A string is a wildcard pattern if it contains one of the
characters `?', `*' or `['. Globbing is the operation that
expands a wildcard pattern into the list of pathnames
matching the pattern.
[ SNIP ]
Character classes
An expression `[...]' where the first character after the
leading `[' is not an `!' matches a single character,
[ SNIP ]
Ranges
There is one special convention: two characters separated
by `-' denote a range. (Thus, `[A-Fa-f0-9]' is equivalent
to `[ABCDEFabcdef0123456789]'.)
[ SNIP ]
PATHNAMES
Globbing is applied on each of the components of a pathÂ
name separately. A `/' in a pathname cannot be matched by
a `?' or `*' wildcard, or by a range like `[.-0]'. A range
cannot contain an explicit `/' character; this would lead
to a syntax error.
[ SNIP ]
NOTES
Regular expressions
Note that wildcard patterns are not regular expressions,
although they are a bit similar. First of all, they match
filenames, rather than text, and secondly, the conventions
are not the same: e.g., in a regular expression `*' means
zero or more copies of the preceding thing.
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/