我想匹配以下输入。如何在不使用多行字符串的情况下匹配一个组一定次数?像 (^(\d+) (.+)$){3}) 之类的东西(但这不起作用)。
sample_string = """Breakpoint 12 reached
90 good morning
91 this is cool
92 this is bananas
"""
pattern_for_continue = re.compile("""Breakpoint \s (\d+) \s reached \s (.+)$
^(\d+)\s+ (.+)\n
^(\d+)\s+ (.+)\n
^(\d+)\s+ (.+)\n
""", re.M|re.VERBOSE)
matchobj = pattern_for_continue.match(sample_string)
print matchobj.group(0)