title: Regular expression negative lookbehind of non-fixed length
body: <p>As the <a href="https://docs.python.org/2/library/re.html" rel="noreferrer">document</a> goes:</p>
  
  <blockquote>
    <p>This is called a negative lookbehind assertion. Similar to positive lookbehind assertions, the contained pattern must only match strings of some <strong>fixed length</strong>. </p>
  </blockquote>
  
  <p>So this will work, the intention is to match any <code>,</code> outside <code>{}</code>, but not inside <code>{}</code>:</p>
  
  <pre><code>In [188]:
  
  re.compile("(?&lt;!\{)\,.").findall('a1,a2,a3,a4,{,a6}')
  Out[188]:
  [',a', ',a', ',a', ',{']
  </code></pre>
  
  <p>this will work, on a slightly different query:</p>
  
  <pre><code>In [189]:
  
  re.compile("(?&lt;!\{a5)\,.").findall('a1,a2,a3,a4,{a5,a6}')
  #or this: re.compile("(?&lt;!\{..)\,.").findall('a1,a2,a3,a4,{a5,a6}')
  Out[189]:
  [',a', ',a', ',a', ',{']
  In [190]:
  </code></pre>
  
  <p>But if the query is <code>'a1,a2,a3,a4,{_some_length_not_known_in_advance,a6}'</code>, according to the document the following won't work as intended:</p>
  
  <pre><code>In [190]:
  
  re.compile("(?&lt;![\{.*])\,.").findall('a1,a2,a3,a4,{a5,a6}')
  Out[190]:
  [',a', ',a', ',a', ',{', ',a']
  </code></pre>
  
  <p>Any alternative to achieve this? Is negative lookbehind the wrong approach?</p>
  
  <p>Any reason this is how lookbehind was designed to do (only match strings of some fixed length) in the first place?</p>