You are viewing a single comment's thread. Return to all comments →
BTW, if you want to do it with regex, this is one way:
import re for _ in range(int(input())): r_in = r"^([a-zA-Z]+) <([a-zA-Z][\w.-]+)@([a-zA-Z]+)\.([a-z]{1,3})>$" found = re.match(r_in, input()) if found: name, username, domain, ext = found.group(1), found.group(2), found.group(3), found.group(4) print(f'{name} <{username}@{domain}.{ext}>')
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 →
BTW, if you want to do it with regex, this is one way: