如何使用正则表达式在Python中验证电子邮件地址?

如何使用正则表达式在Python中验证电子邮件地址?

下面的代码使用Python中的正则表达式验证任何给定的电子邮件地址

更多Python相关文章,请阅读:Python 教程

例子

import re
s = 'manogna.neelam@tutorialspoint.com'
match = re.search(r'\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b', s, re.I)
print match.group()

输出

这将给出输出

manogna.neelam@tutorialspoint.com

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程