I got a big text with a parenthesis and some text inside that needs parsing.
I successfully use this regex (\w+)\s*\:\s*(\(.*)
, to catch everything inside the parenthesis but the I need do another regex inside the result and this fails.
My code:
import re
txt = "COM: (ZZZ, Min: 2, Max: 114)\n"
txt+= "TESTING : BBB"
m = re.match(r'(\w+)\s*\:\s*(\(.*)', txt)
comm = str(m.group(2)).strip()
print(comm) # Output: (ZZZ, Min: 2, Max: 114)
trk = re.match(r"\bMin", comm)
print(trk) # Output: None, should be "Min"
What am I doing wrong?