Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- pattern = re.compile(r"(^|(?<=\s))[a-zA-Z0-9]+[\-_\.]*\w+@\w+[\-_\.]*\w+\.[\w\.]+\b")
- text = input()
- matches = pattern.finditer(text)
- for match in matches:
- print(match.group())
- # valid emails: [email protected],
- # invalid emails: [email protected], …@mail.bg,
- # [email protected], [email protected], mike@helloworld, [email protected]., s.johnson@invalid-.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement