procmail
[Top] [All Lists]

Re: matching subjects with words in []

1997-01-25 14:57:03
jeff(_dot_)covey(_at_)pobox(_dot_)com (jeffrey covey) writes:
i'm on a couple of mailing lists which ask that people start subject
lines with constructs like [MAC] or [ADMIN] to make it easy to sort
out what you're not interested in.  but how do i match on these with
procmail?  the grep manpage led me to believe that if the brackets
were escaped with backslashes, they'd be treated as regular
characters, so i thought \[MAC\] would match [MAC], but that doesn't
see to be the case.

Well, since you didn't show what condition you tried, there's no way to
say what went wrong, or how it went wrong.  Did you try turning on
VERBOSE and looking at the logfile?  You *do* keep a logfile when
testing new recipes, right?  If not, put the following at the top of
you .procmailrc:

LOGFILE = $HOME/procmail.log
VERBOSE = on

Then take a look at procmail.log after mail comes in to see what's going on.


One thing to consider when crafting your condition(s) is where you want to
look for the "[MAC]" or "[ADMIN]".  Presumably they would show up in the
Subject: header, but _where_ in the header?  Only at the beginning of the
header's value (right after the colon), or can they occur later in the
value.  When someone replies to one of these messages does the Subject:
now say "Re: [MAC] blah blah blah"?  If so, and you still want to match
it then you'll need to take into account the "Re:".  I would probably
just say:

* ^Subject:.*\[MAC\]

and be done with it, but you may want to be more specific, say:

* ^Subject: *(re:? *)*\[MAC\]


So, what _did_ you try?

Philip Guenther