At 11/21/00 04:27 PM, Martin Winkler wrote:
>For a subscription tool of a mailing list I'd like to quick-check the 
>e-mail address our users type.

As a check on whether an email address *looks* OK, I use the following 
External Method. If ICANN really approves TLDs that are other than 2 or 3 
characters long then the {2,3} will have to be changed.

Warning: Some mail software between you and me may break up lines in the 
code. There are two executable lines, one starts with "m =" and the very 
next line starts with "return". There are no blanks in the r'...' string.


import re

def wellformedEmail(self, address):
     """ return true if email address appears to be well formed """
     m ='^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z][0-9a-z-]*[0-9a-z]\.)+[a-z]{2,3}$', 
address, re.IGNORECASE)
     return m != None and == address

Dennis Nichols

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to