procmail
[Top] [All Lists]

Re: matching and showing only a part

1999-09-28 11:27:13
  :0 fhw
  *
(^TO|^Received:.*)\/(ed(_at_)tv\(_dot_)com|joe(_at_)aol\(_dot_)com|hey(_at_)whats\(_dot_)happening\(_dot_)com
)
  | formail -A "X-Sent-To-Me-At: $MATCH"

Shouldn't you use something like:
^Received:[ ].*[ ]for([ ]|[ ]\<)\/(x\.com|y\.com|z\.com)

You're right about catching whitespace before the address.  I would have
also caught fred(_at_)tv(_dot_)com, not just ed(_at_)tv(_dot_)com(_dot_)

I might rewrite it this way, then:

   (^TO|^Received:.*for 
<?)\/(ed(_at_)tv\(_dot_)com|joe(_at_)aol\(_dot_)com|hey(_at_)whats\(_dot_)happening\(_dot_)com)

The regex that you provided isn't going to match whitespace that isn't
a space (i.e. tabs, like the one before 'for') or if whitespace is missing
after Received:, and it also won't catch addresses that are enclosed in
angle brackets, like this header:

   Received: from snipe.prod.itd.earthlink.net (snipe.prod.itd.earthlink.net 
[207.217.120.62])
        by lorien.mallorn.com (8.9.3/8.9.3) with ESMTP id EAA25881
        for <lindsey(_at_)example(_dot_)com>; Tue, 28 Sep 1999 04:54:20 -0500

I'm not sure if the \< was supposed to account for that, or if it was 
meant as the macro expansion for word boundaries (which would match
an address like '-ed(_at_)tv(_dot_)com').  But either way it might miss it.

Thanks for pointing out the mistake.  And I'm sure I have many more...  :)

Chris

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