title: regular expression, multiple parentheses and square brackets
body: <p><strong>Answer from @avinash-raj:</strong></p>
  
  <pre><code>re.findall(r'\([^\[\]()]*\[\([^\[\]()]+source=([\w./]+)', s)
  </code></pre>
  
  <p><strong>Modified question:</strong></p>
  
  <p>I have the following string:</p>
  
  <pre><code>s=string='s=&lt;a=1 b=[(text1 [(text2 source=x.gz i=i.gz)]), ([(text3 j=1.0 source=y.gz)])] c=[([(3)])] d=[([(source=x.gz)])]&gt;'
  </code></pre>
  
  <p>I want to get this list as an output:</p>
  
  <pre><code>['x.gz','y.gz']
  </code></pre>
  
  <p><strong>Original question:</strong></p>
  
  <p>I have the following string:</p>
  
  <pre><code>s=string='s=&lt;a=1 b=[([(source=x.gz i=0)]), ([(j=1 source=y.gz)])] c=[([(3)])]&gt;'
  </code></pre>
  
  <p>I want to get this list as an output:</p>
  
  <pre><code>['x.gz','y.gz']
  </code></pre>
  
  <p>I have tried this:</p>
  
  <pre><code>re.findall(r'b=\[([^]]*)\]',s)
  </code></pre>
  
  <p>Which returns:</p>
  
  <pre><code>['([(source=x.gz i=0)']
  </code></pre>
  
  <p>I have also tried this:</p>
  
  <pre><code>re.findall(r'\[([^]]*)\]',s)
  </code></pre>
  
  <p>Which returns:</p>
  
  <pre><code>['([(source=x.gz i=0)', '(j=1 source=y.gz)', '([(3)']
  </code></pre>
  
  <p>I am equally happy for a one line answer or being pointed to a tutorial, which enables me to find the answer myself upon completion of it. Thanks.</p>
  
  <p><strong>EDIT1: Changed string (see answers below):</strong></p>
  
  <pre><code>s=string='s=&lt;a=1 b=[([(source=x.gz i=0)]), ([(j=1 source=y.gz)])] c=[([(3)])] source=4&gt;'
  </code></pre>
  
  <p><strong>EDIT2: Changed string (no answers provided, but I'll provide it myself):</strong></p>
  
  <pre><code>s=string='s=&lt;a=1 b=[(text1 [(text2 source=x.gz i=i.gz)]), ([(text3 j=1.0 source=y.gz)])] c=[([(3)])] d=[([(source=x.gz)])]&gt;'
  </code></pre>
  
  <p>I tried this:</p>
  
  <pre><code>re.findall(r'(?&lt;=b=)\[\(.*?[\S]*?source=([\w\./]+)', s)
  </code></pre>
  
  <p>But it only returns:</p>
  
  <pre><code>['x.gz']
  </code></pre>