procmail
[Top] [All Lists]

Re: Mail subject recipe

2001-03-14 08:54:04
On 14 Mar, Subba Rao wrote:
| On  0, Don Hammond <procmail1(_at_)tradersdata(_dot_)com> wrote:
| > [...]
| > :0 c:
| > * 2147483647^0 ^Subject:.*\<apache\>
| > * B ?? 2147483647^0 apache
| > apache
| > 
| > With this the first condition will keep the body search from needlessly
| > taking place if it matches, and the second one will be an automatic
| > match with the first occurence of apache in the body. Might be a
| > marginal improvement. Note, I also added a trailing ":" for a lockfile
| > on the recipe.
| > 
| 
| Thanks for replying. My first question is the same as Carlos. What is the
| number before "Subject"? One other question is, how can I search in the 
"Subject"
| and "Body" for multiple keywords? For example, I want to search for the 
keywords
| "Apache" and "mod_ssl". If either word appears, I know it is the apache 
project
| and I can put it in the apache file.

The answer (hopefully) to the first question is on the way. The second
answer is:

  * 2147483647^0 ^Subject:.*\<(apache|mod_ssl)\>
  * B ?? 2147483647^0 \<(apache|mod_ssl)\>

Which brings up a point I forgot to make from the original post which
included:

| :0c
| * ^Subject:.*\<apache|Apache\>
| apache

Besides being unnecessary because of procmail's default case
insensitivity, this wouldn't have done what you expected anyway. You
could think of that condition like this: "^Subject:.*\<apache" OR 
"Apache\>". The "\<" and "\>" match word boundaries (literally
[^a-zA-Z0-9_]).  So this would have matched "apache" in the Subject: and
anywhere else in the headers. If in the Subject, apache would have to
start on a word boundary but not necessarily end on one. Anywhere else
in the headers the converse would be true. In other words, that
condition would match any of the following:

 Subject: apache project
 From: someone(_at_)apache(_dot_)org
 From: someone(_at_)wildapache(_dot_)net
 From: "Geronimo the Apache" <geronimo(_at_)aol(_dot_)com> 
 Subject: The Apaches and other Native Americans
 X-BeenThere: announce(_at_)Apache(_dot_)org

Some of those may have been a surprise. ;-)

-- 
                         /"\
Don Hammond              \ /     ASCII RIBBON CAMPAIGN
Raleigh, NC US            X        AGAINST HTML MAIL,
                         / \      AND NEWS TOO

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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