I know this is a very frequently asked question, but it's driving me mad.
I want to use regex to match a substring in my string.
line = '##ParameterValue[part I care about]=garbagegarbage'
And I would like to extract the part I care about
.
My code looks like this:
import re
line = '##ParameterValue[part I care about]=garbagegarbage'
m = re.match('\[(.*)\]', line)
print m.group(1)
But this gives me an AttributeError: 'NoneType' object has no attribute 'group'
I tested my regex on regex101 and it works. I don't understand why this fails for me.