procmail
[Top] [All Lists]

Re: Regexp fails in scoring recipe

2003-05-09 03:49:16
parv asked,

I am confused, why would regex "a[^b]$" not match text "xyz a", thus
turning condition to be true?

To take a slightly different viewpoing from Kevin's answer,

There's nothing there to match [^b]. If it had been [^b]* or [^b]? there would have been a match, because null can match either of those expressions, but null can't match [^b]; that requires exactly one character, which cannot be newline or b (or B if the matching is case-
insensitive).

[^b] needs a character to match to.

Kevin included,

Loosely interpreted, \<a[^b]$ means match any two characters between a
word anchor and an end of line anchor with the first character being a
(or A, assuming the default of case-independent matches) and the second
character being any character except b (or B) or newline.

Er, almost. In procmail, \<, $, \>, and ^ are not anchors; they require actual characters to match to. Even ^^ matches on the putative newline, not on the transition. Usually the result is identical, but sometimes thinking of those expressions as anchors to transition points (as they are in perl or egrep, but not in procmail) will get you into trouble.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail