My dilemma: I\'m passing my function a string that I need to then perform numerous regex manipulations on. The logic is if there\'s a match in the first regex, do one thing
Are the manipulations for each regex similar? If so, try this:
for regex in ('regex1', 'regex2', 'regex3', 'regex4'): match = re.match(regex, string) if match: # Manipulate match.group(n) return result