procmail
[Top] [All Lists]

Re: Regexp fails in scoring recipe

2003-05-09 03:49:16
 parv wrote:

in message <3EB94C31(_dot_)3080704(_at_)bigfoot(_dot_)com>,
wrote Kevin Wu thusly...
:0
* $ ()\<$NOT_AB\$
DID_NOT_FIND_AB

:0 E
DID_FIND_AB

and the sample text is

xyz a

If we use your definition

NOT_AB = "([^a]|a[^b])"

then ... \<a[^b]$ is false so the condition is false
           ^^^^^^^^^^^^^^^

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

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. In the sample line, I'm assuming a newline immediately after "xyz a" so \<a[^b]$ does not match because the sample ends with a single character between the start of word anchor and the end of line anchor.

BTW, there is a mistake in the recipe. We have been discussing searching the message body instead of the headers in this thread. So the recipe should begin with

:0 B

or the condition should use the "B ??" construct.

Kevin




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