I have a file with different field formats on some lines. Some different formats I have found so far are:
NAME
NAME (Alternate name)
NAME [Alternate name a]/[Alternate name b]
I can use regexes to match each different format. In a language I used to use, I dealt with this problem by doing something that in Python I would expect to look like this:
if m = re.search('asd',line):
a = m.group(1)
b = m.group(2)
elif m = re.search('qwe',line):
a = m.group(1)
b = m.group(2)
...which is a syntax error.
I saw the := was out in Python 3.8, but I am trapped at 3.6. Maybe that will let me do this. It doesn't matter, though, because I need to solve the problem using 3.6.
How do I cleanly test a line against multiple regexes and use the match results in Python 3.6?