OT: regex to find email
Peter Hansen
peter at engcorp.com
Tue Sep 21 11:16:45 EDT 2004
Josh Close wrote:
> I've been trying to find a good regex to parse emails, but haven't
> found any to my liking. I basically need to have
>
> ( r'[a-z0-9\.\-\_]@[a-z0-9\.\-\_]', re.IGNORECASE )
>
> but the first part can't start with .-_ and the last part has to have
> a . in it (first/last being before/after the @).
Use this instead:
from email.Utils import parseaddr
See the docs for assistance.
-Peter
More information about the Python-list
mailing list