[wellylug] Procmail recipie problem
Don Jones
don at morphem.gamma.net.nz
Wed Jun 18 23:03:33 NZST 2003
On Tue, 2003-06-17 at 22:42, Ewen McNeill wrote:
> In message <1055845256.551.26.camel at spleen>, Stephen Judd writes:
> >- I think you might have fallen into the first one. If you come from the
> >DOS world, you are used to thinking of * as a wildcard that matches
> >anything. In standard Unix regexes, * is a quantifier that says "zero or
> >more times". ".*" is what matches anything.
>
> If only it were that simple.
>
> Filename patterns use "*" as a multiple-character wildcard match (anywhere
> in the filename/pathname in Unix/Linux; in the DOS world it used to have
> to be at the end -- but that's changed somewhat more recently).
>
> Regular expressions use "*" to mean "zero or more of the previous thing".
>
> Filename patterns use "?" as a single character wildcard. Regular
> expressions use ".". Regular expressions use "?" to mean "the previous
> thing is optional".
>
> >- Perl has very much extended the core regex syntax
>
> IME, _everything_ has its own extended regex syntax. If you're
> particularly lucky some of these extensions happen to be the same as
> other extensions you've come across, but sometimes they're gratitiously
> different.
I agree, vim has its own style which is a bit annoying, heres a page
with a few of the differences:
http://www.greenend.org.uk/rjk/2002/06/regexp.html
The best book on the subject is the oreilly owl book "Mastering Regular
Expressions":
http://www.oreilly.com/catalog/regex/
but any perl/python/[your language here] book should cover it (Learning
perl has 3 chapters on regexes).
Personally I find perl regexes the most powerful.
Regular grep regexes are fairly rudimentary, egrep uses extended regexes
which are better, but best of all newer versions of grep can use perl
regexes using the -P flag - very handy (and easier than perl -ne 'print
if /regex/' file )
Don
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.wellylug.org.nz/pipermail/wellylug/attachments/20030618/56b048a5/attachment.pgp
More information about the wellylug
mailing list