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