Created
March 8, 2019 18:08
-
-
Save mark-mishyn/4be271749d6b44fc1749d4b1ef254497 to your computer and use it in GitHub Desktop.
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
def get_phones_from_text(text: str) -> Set[str]: | |
phone_matches_iterator = re.finditer(r'(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}', text) | |
return set((r.group(0) for r in phone_matches_iterator)) | |
def get_emails_from_text(text: str) -> Set[str]: | |
email_matches_iterator = re.finditer(r'[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+', text) | |
return set((r.group(0) for r in email_matches_iterator)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment