title: python - Return Text Between Parenthesis
body: <p>I have file contains several lines of strings written as :</p>
  
  <pre><code>[(W)40(indo)25(ws )20(XP)111(, )20(with )20(the )20(fragment )20(enlar)18(ged )20(for )20(clarity )20(on )20(Fig. )] TJ
  </code></pre>
  
  <p>I need the text inside the parentheses only. I try to use the following code :</p>
  
  <pre><code>import re
  
  readstream = open ("E:\\New folder\\output5.txt","r").read()
  
  stringExtract = re.findall('\[(.*?)\]', readstream, re.DOTALL)
  string = re.compile ('\(.*?\)')
  stringExtract2 =  string.findall (str(stringExtract))
  </code></pre>
  
  <p>but some strings (or text) not exist in the output e.g, for the above string the word (with) not found in the output. Also the arrangement of strings differs from  the file, e.g,  for strings (enlar) and (ged ) above, the second one (ged ) appeared before (enlar), such as :  ( ged  other strings ..... enlar) How I can fix these problems?</p>