title: xpath expression for regex-like matching?
body: <p>I want to search div id in an html doc with certain pattern.
  I want to match  this pattern in regex: </p>
  
  <pre><code>foo_([[:digit:]]{1.8})
  </code></pre>
  
  <p>using xpath. What is the xpath equivalent for the above pattern?</p>
  
  <p>I'm stuck with <code>//div[@id="foo_</code> and then what? If someone could continue a legal expression for it.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Sorry, I think I have to elaborate more. Actually it's not <code>foo_</code>, it's <code>post_message_</code> </p>
  
  <p>Btw, I use mechanize/nokogiri ( ruby )</p>
  
  <p>Here's the snippet :</p>
  
  <pre><code>html_doc = Nokogiri::HTML(open(myfile))
  message_div =  html_doc.xpath('//div[substring(@id,13) = "post_message_" and substring-after(@id, "post_message_") =&gt; 0 and substring-after(@id, "post_message_") &lt;= 99999999]') 
  </code></pre>
  
  <p>Still failed. Error message:</p>
  
  <blockquote>
    <p>Couldn't evaluate expression '<code>//div[substring(@id,13) = "post_message_" and substring-after(@id, "post_message_") =&gt; 0 and substring-after(@id, "post_message_") &lt;= 99999999]</code>' (Nokogiri::XML::XPath::SyntaxError)</p>
  </blockquote>