Computer >> Computer tutorials >  >> Programming >> Python

How to extract email id from text using Python regular expression?


The following code using Python regex extracts the email id from given string/text

Example

import re
s ='[email protected]'
result =re.findall('[a-zA-Z0-9]\S*@\S*[a-zA-Z]', s)
print result

Output

This gives the output

['[email protected]']