validateEmail.py

Go to the documentation of this file.
00001 import re
00002 import string
00003 
00004 regex = r'[a-zA-Z0-9._%-]+@[a-zA-Z0-9._%-]+.[a-zA-Z]{2,6}'
00005 
00006 regex2 = '[a-zA-Z0-9._%%-]+@(?P<domain>%s)' % (regex.split('@')[-1])
00007 
00008 from vyperlogix.misc import GenPasswd
00009 
00010 delimiters = ''.join(list(set([chr(i) for i in xrange(33,127)]) - set(string.ascii_letters + string.digits + '-._!@#$%()^&+=`"<}*/~[{]|?>' + "'" + '\\'))) + '\n'
00011 
00012 ##
00013 # Returns True if the email address is valid otherwise False.
00014 def validateEmail(email):
00015     _re = re.compile(regex)
00016     return (_re.search(email) != None) and (email.lower() not in ['null@null.com'])
00017 
00018 ##
00019 # Ensure the email address does not contain any funky Unicode chars that may result in a failed validation.
00020 def make_email_chars_valid(email):
00021     _re = re.compile(regex)
00022     return ''.join([match.group() for match in _re.finditer(email)]).strip()
00023 
00024 ##
00025 # Returns the email address parsed using a regex.
00026 def parseEmail(email):
00027     _re = re.compile(regex2)
00028     return _re.findall(email)
00029 
00030 

© Copyright 2008-2009 Vyper Logix Corp., All Right Reserved; If you reference this document or any part of this document you must use the citation verbatim (including the link) "© Copyright 2008-2009 Vyper Logix Corp., All Right Reserved."

Notice: This source code contained in this document is NOT open source and is NOT being distributed as open source.

122,241 lines of code and growing...