xxxxxxxxxx
>>> m = re.match(r"(\w+) (\w+)", "Isaac Newton, physicist")
>>> m[0] # The entire match
'Isaac Newton'
>>> m[1] # The first parenthesized subgroup.
'Isaac'
>>> m[2] # The second parenthesized subgroup.
'Newton'
xxxxxxxxxx
>>> p = re.compile('(a(b)c)d')
>>> m = p.match('abcd')
>>> m.group(0)
'abcd'
>>> m.group(1)
'abc'
>>> m.group(2)
'b'
xxxxxxxxxx
report = """==== Exception State ====\n
SWC ID: 110\n
Severity: Medium\n
Contract: MAIN\n
Function name: fallback\n
PC address: 0\n
An assertion violation was triggered.\n"""
g = re.search(r"SWC ID: ([0-9]+)",report)
print(g[0])
OUT: SWC ID: 110
print(g[1])
OUT: 110