title: XPath to find all links with just numbers in them?
body: <p>I've selected the element in a page that has the links I want to the pages. They are sort of like <code>&lt;a href="blah"&gt;1&lt;/a&gt;</code>. I want to use regex with xpath so that I can get all the links like that one, whose text is <code>\d+</code>.</p>
  
  <p>I see there is an answer for it here: <a href="https://stackoverflow.com/questions/2755950/how-to-use-regular-expression-in-lxml-xpath">How to use regular expression in lxml xpath?</a> but I can't make sense out of it.</p>
  
  <p>More specifically, "Note that you need to give the namespace mapping, so that it knows what the "re" prefix in the xpath expression stands for."</p>
  
  <p>Here's the code from the page cleaned up: <code>&lt;div class="pagination"&gt; &lt;b&gt;1&lt;/b&gt; &lt;a href="?page=post&amp;amp;s=list&amp;amp;tags=tag2+tag1&amp;amp;pid=25"&gt;2&lt;/a&gt;&lt;a href="?page=post&amp;amp;s=list&amp;amp;tags=tag2+tag1&amp;amp;pid=50"&gt;3&lt;/a&gt;&lt;a href="?page=post&amp;amp;s=list&amp;amp;tags=tag2+tag1&amp;amp;pid=75"&gt;4&lt;/a&gt;&lt;a href="?page=post&amp;amp;s=list&amp;amp;tags=tag2+tag1&amp;amp;pid=100"&gt;5&lt;/a&gt;&lt;a href="?page=post&amp;amp;s=list&amp;amp;tags=tag2+tag1&amp;amp;pid=125"&gt;6&lt;/a&gt;&lt;a href="?page=post&amp;amp;s=list&amp;amp;tags=tag2+tag1&amp;amp;pid=150"&gt;7&lt;/a&gt;&lt;a href="?page=post&amp;amp;s=list&amp;amp;tags=tag2+tag1&amp;amp;pid=175"&gt;8&lt;/a&gt;&lt;a href="?page=post&amp;amp;s=list&amp;amp;tags=tag2+tag1&amp;amp;pid=200"&gt;9&lt;/a&gt;&lt;a href="?page=post&amp;amp;s=list&amp;amp;tags=tag2+tag1&amp;amp;pid=225"&gt;10&lt;/a&gt;&lt;a href="?page=post&amp;amp;s=list&amp;amp;tags=tag2+tag1&amp;amp;pid=250"&gt;11&lt;/a&gt;&lt;a href="?page=post&amp;amp;s=list&amp;amp;tags=tag2+tag1&amp;amp;pid=25" alt="next"&gt;›&lt;/a&gt;&lt;a href="?page=post&amp;amp;s=list&amp;amp;tags=tag2+tag1&amp;amp;pid=325" alt="last page"&gt;»&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;iframe hspace="0" vspace="0" border="0" marginheight="0" marginwidth="0" allowtransparency="true" src="http://notrelevant.com" frameborder="0" height="98" scrolling="no" width="736"&gt;&lt;/iframe&gt;&lt;/div&gt;</code></p>
  
  <p>My code so far:</p>
  
  <pre><code>answer = browser.open(address)
  tree = lxml.html.parse(answer)
  numbers = tree.xpath("//div[contains(@class, 'pagination')]")[0]
  </code></pre>