procmail
[Top] [All Lists]

Re: Regular Expression Misunderstanding

1998-11-27 11:40:54
On 11/27/98 9:57 AM, Kevin Benko <kevin(_at_)efn(_dot_)org> wrote...

Now this next one is bugging me, and is probably a misunderstanding of
regular expressions on my part

       :0:
       * (^TO_|From:).*someaddress
       somefolder

This one seems to work properly, catching email to or from
someaddress.  However:

       :0:
       * (^From:|TO_).*someaddress
       somefolder

doesn't catch those emails _to_ someaddress, so I'm thinking that the
first recipe is also flawed in some way that I don't realize.

Because you're missing your ^ on the TO_. Try:

     :0:
     * ^(From:|TO_).*someaddress
     somefolder

The first recipe is slightly flawed, in that it will act on From: 
anywhere in the headers. Unless I'm mistaken, it might catch something 
like X-Posting-From: Blah. Putting in the ^ guarantees that it only acts 
on that if it's at the beginning of a line.

HTH...


-- 
Adam Bailey      | Chicago, Illinois
adamb(_at_)tezcat(_dot_)com | "Logic is the art of going wrong with
adamkb(_at_)aol(_dot_)com   |  confidence." - George Bernard Shaw
Finger for PGP   | http://www.tezcat.com/~adamb/

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