Validating and Parsing Email Addresses

  • + 0 comments

    import re pattern = r'^[a-zA-z][a-zA-Z0-9_.-]*@[a-z]+.[a-z]{1,3}$'

    n = int(input()) for i in range(n): i = input().strip() m = re.match(r'(.+)<(.+)>',i) if m: name = m.group(1).strip() email = m.group(2).strip() if re.match(pattern,email): print('{} <{}>'.format(name,email))

    help me find the problem in my code because i have passed 6 out of 7 cases but this code is failing agaist test case 3 i don't know why even chat GPT could not help if anyone it would be quite appreciating and i will be obliged of him...