You are viewing a single comment's thread. Return to all comments →
from re import compile from email.utils import parseaddr, formataddr rex_email = r'''(?aix)^ (?P<user>[a-z][-\w.]*) [@] (?P<domain>[a-z]+) [.] (?P<extension>[a-z]{1,3}) $ ''' pattern = compile(rex_email) for each in range(int(input())): name, addr = parseaddr(input()) if not (name and addr): continue if not pattern.match(addr): continue print(formataddr((name, addr)))
Seems like cookies are disabled on this browser, please enable them to open this website
Validating and Parsing Email Addresses
You are viewing a single comment's thread. Return to all comments →