procmail
[Top] [All Lists]

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

1998-10-21 00:48:24
On Wed, 21 Oct 1998 00:34:39 +0000, Darren Wyn Rees
<merlin(_at_)A470(_dot_)demon(_dot_)co(_dot_)uk> wrote:
On Tue, Oct 20, 1998 at 12:24:43AM +0300, era eriksson wrote:
An example of what I would like to delete:
the single line email with "unsubscribe" in it.
:0B
* ^^unsubscribe^^
/dev/null
Sorry, but this does not match.  (Whether I am doing something
wrong, I would hope someone could perhaps clarify.)

The regular expression says, anchor the search to the beginning and
end of the search space, and match the literal string "unsubscribe"
between those two anchors. No more, and no less. The :B flag sets the
search space to the body of the message. Unfortunately, as you found,
it doesn't work. :-(

 $ cat test.rc
 SHELL=/bin/sh
 MAILDIR=.
 DEFAULT=oops
 VERBOSE=yes

 :0B:
 * ^^unsubscribe^^
 unsub

 $ procmail ./test.rc <<HERE
From person
From: person
X-Headers: lots
 of
 em
Subject: The headers don't matter
X-Mailer: telnet

unsubscribe
HERE
 procmail: [5644] Wed Oct 21 10:18:28 1998
 procmail: No match on "^^unsubscribe^^"
 procmail: Locking "oops.lock"
 procmail: Assigning "LASTFOLDER=oops"
 procmail: Opening "oops"
 procmail: Acquiring kernel-lock
 procmail: Unlocking "oops.lock"
 From person
  Subject: The headers don't matter
   Folder: oops                                                             114

 $ cat test2.rc
 SHELL=/bin/sh
 MAILDIR=.
 DEFAULT=oops
 VERBOSE=yes

 :0B:
 * ^^unsubscribe$*^^
 unsub

 $ procmail ./test2.rc <<HERE
From person
From: person
X-Headers: lots
 of
 em
Subject: The headers don't matter
X-Mailer: telnet

unsubscribe
HERE
 procmail: [12072] Wed Oct 21 10:25:01 1998
 procmail: Match on "^^unsubscribe$*^^"
 procmail: Locking "unsub.lock"
 procmail: Assigning "LASTFOLDER=unsub"
 procmail: Opening "unsub"
 procmail: Acquiring kernel-lock
 procmail: Unlocking "unsub.lock"
 From person
  Subject: The headers don't matter
   Folder: unsub                                                            114

I examined this with \/ and the log revealed that $* matched zero
newlines. Even if this is documented somewhere, it's definitely
different from what one would expect. Comments, anyone? Is this a bug?
(Or do I finally need to really get down and understand putative
newlines?) 

/* era */

-- 
Bot Bait: It shouldn't even matter whether  (`')  Just  (`')  http://www.iki
I am a resident of the State of Washington   \/ Married! \/   .fi/~era/