title: Python extract text between regex matches
body: <p>I have a text file that I want to extract data from using Python. An example of the file is as follows:</p>
  <pre><code>123
  text I want to extract is here. 
  456
  I also need this part
  789
  and this 
  </code></pre>
  <p>Now, if I use a regular expression as follows:</p>
  <pre><code>re.match(r'^(\d){3}$', text)
  </code></pre>
  <p>I can get the numbers, however, I would want to get the text between the numbers. I know I can use re.split, but if I do re.split with the same expression i.e.</p>
  <pre><code>re.split(r'^(\d){3}$', text)
  </code></pre>
  <p>it will split it as follows:</p>
  <pre><code>['123', 'text I want to extract is here. 456 I also need this part 789 and this']
  </code></pre>
  <p>The outcome I want to obtain is instead, this:</p>
  <pre><code>['text I want to extract is here.','I also need this part', 'and this']
  </code></pre>
  <p>Any advice on how to achieve this?</p>
  <p>Thanks!</p>
  <p><strong>EDIT</strong>: I realise that there are ways to match exactly the text between the numbers. However, my example is more complex in reality and there is no easy way to write a regex match for the text in between the numbers. This is why I am interested in knowing whether the regex match of the numbers can be used to extract the text in between them.</p>