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
Hmm... you could use something with the with construct... um
class rewrapper()
def __init__(self, pattern, target):
something
def __enter__(self):
something
def __exit__(self):
something
with rewrapper("regex1", string) as match:
etc
with rewrapper("regex2", string) as match:
and so forth