email format in python

Dark Cowherd darkcowherd at gmail.com
Wed Jul 20 00:15:06 EDT 2005


This seems to give reasonable results. 
import re
pattern = r'\b[A-Za-z0-9._%-]+@[A-Za-z0-9._%-]+\.[A-Za-z]{2,4}\b'
pattobj = re.compile(pattern)
ps = pattobj.search     
if ps(stringtocheck):


But as lots of people have already told you on this list. This should
only be used to give a warning and not prevent the use of that
particular address.

DarkCowherd



More information about the Python-list mailing list