
July 22, 2009
8:17 a.m.
Steven D'Aprano wrote:
def multimatch(s, *patterns): """Do a re.match on s using each pattern in patterns, returning the first one to succeed, or None if they all fail.""" for pattern in patterns: m = re.match(pattern, s) if m: return m
How are you supposed to tell which one matched? -- Greg