procmail
[Top] [All Lists]

Re: Matching 6 lines in the body, in order

1998-06-12 11:11:57
Edward Sabol suggested to Timothy Luoma,

S> My belief is that this is more efficient (especially for long messages)
S> than doing a a body search for five separate strings.

Yes; it's not only more efficient, it also is more suitable for this
situation, since five separate conditions could accept the appearance of
those lines in any sequence scattered anywhere through the body (not even
necessarily together).

Timothy responded,

L> Change that to:

L> :0fhw
L> * B ?? ^^($)*(Authenticated sender is.*$)\
L>          (Subject:.*$)\
L>          (Mime-Version: 1\.0$)\
L>          (Content-Type: text/plain; charset="us-ascii"$)\
L>          (Content-Transfer-Encoding: 7bit$)
L> | formail -A"X-SpamChecker: 5-fold-spam-match"

| And it works perfectly (note the ':0fhw' which is very important)

In fact, you can put the B flag onto the flag line since there are no other
regexp conditions that use other search areas, and you can omit some of the
extra parentheses [they don't hurt; still, I should think they'd take time
for procmail to read in]; even those around the first dollar sign should be
unnecessary, but I would feel better leaving them in:

   :0Bfhw
   * ^^($)*Authenticated sender is.*$\
            Subject:.*$\
            Mime-Version: 1\.0$\
            Content-Type: text/plain; charset="us-ascii"$\
            Content-Transfer-Encoding: 7bit$
   | formail -A"X-SpamChecker: 5-fold-spam-match"

Yes, you can combine B and h or b and H flags, and procmail will not get
confused.