How to validate an email id using regular expression in Python?



The following code validates any given email id using regex in Python

Example

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()

Output

This gives the output

manogna.neelam@tutorialspoint.com

Advertisements