How can one separate a string of emails with no separator and different domains/number of letters after ‘@‘?
hello@you.comhi@me.com.secontact@you.com.brcontact@us.org
Is it possible to structure: If ends with .br or .se: separate there Else, separate after .com ?
One possibility is to use regular expression (regex101):
import re
s = "hello@you.comhi@me.com.secontact@you.com.brcontact@us.org"
emails = re.findall(r"[^@]+@[^@]+(?:\.com|\.se|\.br|\.org)", s)
print(emails)
Prints:
['hello@you.com', 'hi@me.com.se', 'contact@you.com.br', 'contact@us.org']