procmail
[Top] [All Lists]

Problem with matching From .net.com and others

1998-01-06 13:23:28
On Tue, 6 Jan 1998 09:08:20 -0500, Laurence Michaels
<lmichael+procmail(_at_)esun19(_dot_)gdc(_dot_)com> wrote:
I'm trying to match on email From something like any one of the
following:
someone(_at_)test(_dot_)net(_dot_)com
someone(_at_)test(_dot_)com(_dot_)com
someone(_at_)test(_dot_)com(_dot_)gdc(_dot_)com
someone(_at_)test(_dot_)com(_dot_)esun19(_dot_)gdc(_dot_)com
Here's what I've got so far in the recipe...
:0
<snip several other expressions>
* 100^1 ^From.*\.(net|com|edu).*\.com
<snip action>

If I read your question (or rather, your mind) correctly, you want
something more like

    * 100^1 ^From.*\.(net|com|edu)\.(.*\.)?com

You could tighten up the last parenthesized expression to something
like ([-a-zA-Z0-9]*\.)? instead. This is still not perfect, though, as
you might stumble over a From: header where the "real name" part
matches your regex:

    From: your.friendly.net.maniac.from.bar.com <moo(_at_)bar(_dot_)com>

This is a convoluted example but the fixes aren't all that much more
expensive: (a) restrict matching to only the From_ line, if you can,
or (b) trim down the stuff on the From: line to barely the email
terminus and then compare that against your regex:

    FROM=`formail -rtzxTo:`
    :0
    * ... other conditions
    * 100^1 FROM ?? \.(net|com|edu)\.(.*\.)?com
    action

This formail trick is a bit twisty but my humble (cough) bronto-FAQ at
<http://www.iki.fi/~era/procmail/mini-faq.html> tries to explain it a
little bit. This is "the standard" solution to stripping comments from
the From: line, but it is by no means perfect. (Make sure you
understand the difference between formail -rt and formail -r and
decide which you want to use here.)

I have switched over to using
* 100^1 ^From.*\.(net|com|edu)[A-Za-z.]*\.com
This will probably work.

This would match anything(_at_)ix(_dot_)netcom(_dot_)com, is that your 
intention?
                            ^^^^   ^^^^
Hope this helps,

/* era */

-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>

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