procmail
[Top] [All Lists]

Re: MATCH with OR

2001-10-25 12:11:04

Hiya.

On Thu, Oct 25, 2001 at 07:21:55PM +0100, Martin McCarthy wrote:

Again, it is easily confirmed by trying it.  Put it in a condition, send
a suitable mail, and look what happens.

Okay, done.  And you won't like the results.  ;-)

        :0 fw
        * ^Subject:[    ]*\/(one|two)
        | formail -A "X-testing: $MATCH"

This will generate "X-testing" header lines with the expected content.

        :0 fw
        * Subject:[     ]*\/one|two
        | formail -A "X-testing: $MATCH"

This creates header lines of "X-testing: one" in the first test, but
if the subject is "two", the header line is just "X-testing: ".

So my original supposition WAS correct, and if an or bar is used outside
brackets, it will join multiple conditions, each of which can have its
own \/ token.  In the above example, an empty "X-testing:" header line
if the word "two" appears anywhere in the headers.

Which means that the other way to make this work is:

        :0 fw
        * ^Subject:[    ]*\/one|^Subject:[      ]*\/two
        | formail -A "X-testing: $MATCH"

Interesting.

The \/ splits the regex into two parts and the two parts are treated
differently.  Any further than that and I am also theorising, since I
can't pretend to know the code in regexp.c.

Ah, but the \/ token is not part of the regular expression, it's an
extension that's specific to procmail.  Regular expressions would deal
with this sort of thing using backreferences, which (according to list
traffic last week) procmail does not support.


-- 
  Paul Chvostek                                             
<paul(_at_)it(_dot_)ca>
  Operations / Development / Abuse / Whatever       vox: +1 416 598-0000
  IT Canada                                            http://www.it.ca/

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

<Prev in Thread] Current Thread [Next in Thread>