procmail
[Top] [All Lists]

searching subject and body

1998-03-31 13:15:03
Jari Aalto suggested to Chuan Wang,

|     :0
|     * H ?? Subject:.*remove
|     * B ?? \<remove\>
|     { .. do it ... }

Accepting it in the subject is a good idea, but Jari's code requires that
both the subject and the body contain the word.  The two need to be ORed, not
ANDed.  Since the search areas are different, simple ORing with a pipe symbol
doesn't work here.

In addition to the standard ways of coding OR, here's a special one for
searching the subject and the body for a given word in either:

  :0 flags
  * HB ?? ^^(.+$)*(Subject:(.*[^a-z0-9])?|$(.*\<)*)remove\>
  action

If the string doesn't have to be preceded by a word border, it gets a little
simpler:

  * HB ?? ^^(.+$)*(Subject:.*|$(.|$)*string