Im looking to use single function to match for multiple values that can be used within another function.
I can get below to work with single regex value, looking for advise to match on second regex "regex2"
Working ---
def parse_desc(description):
regex = r"^Created on\((.*?)\) for (.*?) "
matches = re.finditer(regex, description, re.MULTILINE)
for matchNum, match in enumerate(matches):
return match.groups()
return '', ''
Proposed --- trying to find match for both "Created on" and "Copied On"
def pass_desc(description):
regex = r"^Created on\((.*?)\) for (.*?) "
regex2 = r"^(.*?)Copied on (.*?) "
matches = re.finditer(regex, description, re.MULTILINE) or re.finditer(regex2, description, re.MULTILINE)
for matchNum, match in enumerate(matches):
return match.groups()
return '', ''
I can get both regexs to work as single functions