On Sat, 7 Aug 1999 15:36:36 -0400 (EDT), Reto Lichtensteiger
<rali(_at_)meitca(_dot_)com> wrote:
:0
* ^To:.*someone
* ^From[ ]+\/[-!#-'*+/-9=?A-Z^-~]+(_at_)[-!#-'*+/-9=?A-Z\.^-~]+
| $SENDMAIL -f $MATCH -oi -t someone(_at_)somedomain(_dot_)com
The thing in the brackets is "[<tab><space>]" and the odd thing
after "\/" tells procmail to get the address part of the from (and
not the date string, if any) and stick it in the variable $MATCH
(That regex is ugly; anyone who's more comfortable with them care
to send me -- and Mr. Conover -- something prettier?)
I've never seen a great need to be very defensive when constructing
regular expressions for this particular case. A simple rule which has
never failed is to grab everything after the first space and up to,
but not including, the next space:
* ^From[ ]+\/[^ ]+
There are awful twists to what in +principle+ constitutes a valid
RFC822 address, but I've never seen anything in practice which
violated this. (I believe "foo bar"@example.org is a valid address.
Coding for a pathological case like this is probably not worth it.)
F A M O U S L A S T W O R D S
I tried to overwrite this over the other text but it wasn't legible :-)
/* era */
<http://www.qz.to/~eli/faqs/addressing.html> has some fun variants of
wicked but valid mail addresses. Eli's machine is rarely up nowadays,
it seems; his FAQ is also available from <http://www.faqs.org/> though
--
Too much to say to fit into this .signature anyway: <http://www.iki.fi/era/>
Fight spam in Europe: <http://www.euro.cauce.org/> * Sign the EU petition