procmail
[Top] [All Lists]

Re: My brain hurts

1998-08-21 11:33:49
"Robertson, Hedley J. SPC" 
<robertsh(_at_)emh(_dot_)gordon(_dot_)army(_dot_)mil> writes:
I have the following recipie:


:0 c
* ^From.*\.(mil|dod|gov)
* BH ?? ^[      ]*subscribe signet.*(\.(mil|dod|gov))
| ./approve

I don't want it to match on things like this:

subscribe signet person(_at_)mindspring(_dot_)com
subscribe signet "Hedley Robertson" <robertsh11(_at_)hotmail(_dot_)com>

What you have doesn't.


But I do want it to match on thngs like this

subscribe signet "Hedley Robertson" 
robertsh(_at_)emh(_dot_)gordon(_dot_)army(_dot_)mil
subscribe signet "Hedley Robertson" 
<robertsh(_at_)emh(_dot_)gordon(_dot_)army(_dot_)mil>

Basically I want to filter out anything that doesn't end in a .mil, .dod, or
.gov.  

One problem I have with my recipie is that it will match
someperson(_at_)system(_dot_)government(_dot_)mil(_dot_)au since it matches a 
.mil.

Also, how to I check in procmail for the possible trailing > in the e-mail
address?  

Just put a condition on what comes after the (mil|dod|gov) in the regexps:

        :0 c
        * ^From.*\.(mil|dod|gov)($|[^-a-z0-9_.])
        * BH ?? ^[      ]*subscribe signet.*\.(mil|dod|gov)($|[^-a-z0-9_.])
        | ./approve

That'll match only when the mil, dod, or gov is either at the end of
the line, or followed by something besides a letter, number, minus
sign, underbar or period.


Philip Guenther

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