Created
November 6, 2014 09:04
-
-
Save j08lue/349de1a82f587c16eab9 to your computer and use it in GitHub Desktop.
extract email addresses from some string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def extract_email_addresses(adds): | |
adds = ''.join(adds.split()) | |
adds = re.sub(r'(\"|\,)', ' ', adds) | |
adds = re.split(r'\<(.*?\@.*?)\>', adds) | |
#adds = re.findall(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$", ''.join(adds)) | |
adds = [a for a in adds if '@' in a] | |
return adds | |
if __name__ == '__main__': | |
adds = """ | |
""" | |
adds = extract_email_addresses(adds) | |
print '\n'.join(sorted(adds)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment