Find a substring in block of text, unless it is part of another substring
<p>I was looking for an efficient way to find a substring between two expressions, unless the expression is a part of another.</p>

<p>For example:</p>

<blockquote>
  <p>Once upon a time, in a time far far away, dogs ruled the world. The End.</p>
</blockquote>

<p>If I was searching for the substring between <strong>time</strong> and <strong>end</strong>, I would receive:</p>

<blockquote>
  <p>in a time far far away, dogs ruled the world. The</p>
</blockquote>

<p>or </p>

<blockquote>
  <p>far far away, dogs ruled the world. The</p>
</blockquote>

<p>I want to ignore if <strong>time</strong> is a part of <strong>Once upon a time</strong>. I didn't know if there was a pythonic method without using crazy for loops and if/else cases.</p>

<p>Just remove 'Once upon a time' and check what's left.</p>

<pre><code>my_string = 'Once upon a time, in a time far far away, dogs ruled the world. The End.'
if 'time' in my_string.replace('Once upon a time', ''):
    pass
</code></pre>

python python-2.7