title: Python re negative lookbehind assertion if following pattern allows repetitions
body: <p>I can't make negative lookbehind assertion work with the python re module if the following pattern allows repetitions:</p>
  
  <pre><code>import re
  
  ok = re.compile( r'(?&lt;!abc)def' )
  print( ok.search( 'abcdef' ) ) 
  # -&gt; None (ok)
  print( ok.search( 'abc def' ) )
  # -&gt; 'def' (ok)
  
  nok = re.compile( r'(?&lt;!abc)\s*def' )
  print( nok.search( 'abcdef' ) ) 
  # -&gt; None (ok)
  print( nok.search( 'abc def' ) )
  # -&gt; 'def'. Why???
  </code></pre>
  
  <p>My real case application is that I want to find a match in a file only if the match is not preceded by 'function ':</p>
  
  <pre><code># Must match
  mustMatch = 'x = myFunction( y )'
  
  # Must not match
  mustNotMatch = 'function x = myFunction( y )'
  
  # Tried without success (always matches)
  tried = re.compile( r'(?&lt;!\bfunction\b)\s*\w+\s*=\s*myFunction' )
  print( tried.search( mustMatch  ) ) 
  # -&gt; match
  print( tried.search( mustNotMatch  ) )
  # -&gt; match as well. Why???
  </code></pre>
  
  <p>Is that a limitation?</p>