title: python how to extract the text between two known words in a string?
body: <p>how to extract the text between two known words in a string with a condition that the text between these words can be i) 1 character ii) 1 word iii) 2 words etc.?</p>
  
  <p>Sample Text:</p>
  
  <pre><code>text = ("MNOTES - GEO GEO MNOTES 20 231-0005 GEO GEO GEO GEO GEO MNOTES SOME REVISION MNOTES CASUAL C GEO GEO GEO GEO GEO MNOTES F232322500 MNOTES HELP PAGES GEO GEO GEO GEO MNOTES SHEET 1 OF 3 GEO GEO MNOTES CASUAL E. GEO GEO MNOTES SITPOPE/TIN AY GEO GEO MNOTES R GEO GEO GEO GEO MNOTES 22+0436/T.SKI/11-AUG-1986 GEO GEO GEO GEO MNOTES 231-0045 GEO")
  </code></pre>
  
  <p>I have a string like above that have multiple occurrences of these two known words <code>'MNOTES'</code> and <code>'GEO'</code>, however the text between them can be anything and any number of words.</p>
  
  <p>I wanted to extract sometimes the text that has only one character between those two known words or sometimes the text that has 2 words between those two known words or sometimes the text that has 6 words between those two known words etc.,
  So, how can i extract along with the condition  ?</p>