procmail
[Top] [All Lists]

RFC822 compliant email address

2002-07-03 12:21:16
I am looking for a regexp usable in a procmail recipe which checks if
an email address is valid according to rfc822. One exception of rfc822
could be that the local-part is not composed of characters within double 
quotes. I also don't want to allow a domain part consisting of an IP address.

I started with the following regexp line

 * subscraddr ?? ^[^ ;@<>,:()"\]*[^ 
;.@<>,:()"\]+(_at_)[-a-z0-9]+\(_dot_)[-a-z0-9]+
 
The local part is only valid if it doesn't consist of any of the characters
in square brackets. The second list in square brackets inccludes a dot
because an address like user(_dot_)(_at_)domain is not valid but 
(_dot_)user(_at_)domain is
valid.

The drawback of my solution is, that I don't know how to exclude square
brackets and that the local part could contain characters outside the 
[[:print:]] regexp. This is a regexp which cannot be used with procmail.
Maybe I could add a second condition like

 * subscraddr ?? ^.+@

to limit the range of possible characters?

Does somebody saw a regexp which is smarter?

Werner
-- 
Werner Reisberger         pgp-public-key available:
                     http://www.pure.ch/mypubkey.txt
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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