title: python regular expression find text between tags but the file is not in html or xml format
body: <p>I have a text file which has the format below, and I am trying to get the text between the <code>&lt;doc&gt;</code> tags. But the <code>&lt;doc&gt;</code> tags repeat many times and the file is not in a standard xml or html format, and this causes a problem.</p>
  
  <p>Format:</p>
  
  <p><code>&lt;doc id = "some_number" url = " some_link " title = " some_title " &gt;</code></p>
  
  <p><code>text here</code></p>
  
  <p><code>&lt;/doc&gt;</code> //then again </p>
  
  <p><code>&lt;doc id = "some_number" url = " some_link " title = " some_title " &gt;</code></p>
  
  <p><code>text here</code> </p>
  
  <p><code>&lt;/doc&gt;</code>  // and so on</p>
  
  <p>I tried to get the text using Beautiful soup in python but it said that this object is not callable, and I am guessing it is because it is not in html file format. Moreover I tried using regular expressions so I wrote </p>
  
  <p><code>pattern = re.compile("&lt;doc.*?&gt;(.*?)&lt;/doc&gt;")</code></p>
  
  <p><code>pattern.findall(string_text) # string_text is my file</code></p>
  
  <p>but no match is found. </p>
  
  <p>Thanks for your help. </p>