title: Regex pattern skips last matches and misses content with parenthesis
body: <p>Say I have a string:</p>
  <pre><code>r'pat1=a, pat2=b, (e, e*89=f), bb, pat3=c, pat4=hi, pat10=ex'
  </code></pre>
  <p>I need to extract patterns as:</p>
  <pre><code>pat1=a, 
  pat2=b, (e, e*89=f), bb, 
  pat3=c, 
  pat4=hi, 
  pat10=ex
  </code></pre>
  <p>This is the pattern I tried:</p>
  <pre><code>re.findall(r'(pat\d*.*?)[(pat\d*)|$]', s)
  </code></pre>
  <p>which gives me:</p>
  <pre><code>['pat1=', 'pat2=b, ', 'pat3=c, ', 'pat1']
  </code></pre>
  <p>I am more interested in knowing how exactly my pattern is working here that it did not match the required string. Also what could be the solution.</p>