procmail
[Top] [All Lists]

Re: filtering "uns*bscribe"-type requests etc.

1998-10-21 07:57:32
Darren Rees wrote,

| >  > An example of what I would like to delete:
| >  > the single line email with "unsubscribe" in it.

Era Eriksson seems to have been the one who suggested,

| > You don't need scoring for that.
| >
| >     :0B
| >     * ^^unsubscribe^^
| >     /dev/null

And Darren found,

| Sorry, but this does not match.

No, it won't.  When the search area is the body, the head, or the entire
message, there will always be at least one real newline (usually two, some-
times more) just before the closing putative newline.  You can put printing
text (like the "e" in "unsubscribe") right up against the closing putative
newline only when the search area is a variable.

Taking Liviu's and Philip's advice that ([      ]|$) is more efficient than
( |     |$), I'll suggest this as a way to see whether the word "unsubscribe"
is the only printing text in the body:

  :0B
  * ^^([        ]|$)*unsubscribe([      ]|$)*^^
  /dev/null

You could change the last asterisk to a plus sign with no damage.

Even a one-line body will have a closing (real) newline at the end of the
text plus, unless you're using raw mode, another (real) newline to make
sure the body ends in an empty line, and THEN the closing putative newline.
So if you're positive that there will be no spaces or tabs or additional
blank lines, you'll still something like need this for an exact match:

 * ^^unsubscribe$($)^^

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