Select all elements between two specific elements
<p>I need to select all <code>a</code> tags from <code>&lt;a class="self"&gt;</code> to <code>&lt;a class="next"&gt;</code>. Here is example</p>

<pre><code>&lt;span class="pages"&gt;
    &lt;a class="prev"&gt;&amp;nbsp;&lt;/a&gt;
    &lt;a&gt;13&lt;/a&gt;
    &lt;a&gt;14&lt;/a&gt;
    &lt;a&gt;15&lt;/a&gt;
    &lt;a&gt;16&lt;/a&gt;
    &lt;a class="self"&gt;17&lt;/a&gt;
    &lt;a&gt;18&lt;/a&gt;
    &lt;a&gt;19&lt;/a&gt;
    &lt;a&gt;20&lt;/a&gt;
    &lt;a&gt;21&lt;/a&gt;
    &lt;a class="next"&gt;&amp;nbsp;&lt;/a&gt;
&lt;/span&gt;
</code></pre>

<p>There are <code>href</code>s attributes. I don't want to get anything before class <code>self</code>. I want everything from <code>self</code> to end of the <code>span</code> element.</p>
