 <p>the second <code>r.index('something')</code> will find the first one. You need something like:</p> <pre><code>a = str(r[r.index('word001'):r.index('#something')]) b = str(r[r.index('word002'):r.index('#something', start=r.index('#something')+1)]) </code></pre> <p>This will find the first <code>#something</code> and continue searching after that one.</p> <p>But that is not very good if you have more <code>word</code> patterns you need to find. Maybe better would be:</p> <pre><code>import re re.findall("(word\\d+%20)", "word001%20#something=637448word002%20#something=278364") # this returns word0001%20 and word002%20 </code></pre>