title: Negative lookbehind in Python regular expressions
body: <p>I am trying to parse a list of data out of a file using python - however I don't want to extract any data that is commented out. An example of the way the data is structured is:</p>
  
  <pre><code>#commented out block
  uncommented block
  #   commented block
  </code></pre>
  
  <p>I am trying to only retrieve the middle item, so am trying to exclude the items with hashes at the start. The issue is that some hashes are directly next to the commented items, and some arent, and the expression I currently have only works if items have been commented in the first example above -</p>
  
  <pre><code>(?&lt;!#)(commented)
  </code></pre>
  
  <p>I tried adding \s+ to the negative lookahead but then I get a complaint that the expression does not have an obvious maximum length. Is there any way to do what I'm attempting to do?</p>
  
  <p>Thanks in advance,</p>
  
  <p>Dan</p>