I am trying to infer the pattern from a list of email to see if the email id follows firstname.lastname or lastname.firstname pattern. I can match email by using an 'or' with the possible patterns like below
re.match("|".join([regex_pat1, regex_pat2]), email)
Once I get a match, how do I know which regex pattern string from list matched the target email?
edit: example
import re
email = "[email protected]"
patt = ["[email protected]", "[email protected]"]
re.match("|".join(patt), email)
This gives me a match object <_sre.SRE_Match object; span=(0, 30), match='[email protected]'>
What I want to know is which one of my pattern from my 'patt' list matched
sambrohn@gmailecom. - Amadan