Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def to_email(text):
- """Returns a list of the email addresses found in ``text``
- According to rfc2822 the allowed characters are letter and digits and
- "!" / "#" / ; SP, and specials.
- "$" / "%" / ; Used for atoms
- "&" / "'" /
- "*" / "+" /
- "-" / "/" /
- "=" / "?" /
- "^" / "_" /
- "`" / "{" /
- "|" / "}" /
- "~"
- Therefore remove also " and () around the addresses
- and additionally ' because it is sometimes added to names that are taken from email address
- and doubt that other clients can handle it.
- Warning: can create double entries
- """
- if not text: return []
- return re.findall(r'([^ ,(\'"<@]+@[^> ,)\'"]+)',text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement