Nokogiri can do this (now) using jQuery extensions to CSS:
require 'nokogiri'
html="
<html>
<body>
<p>foo</p>
<p>bar</p>
</body>
</html>
"
doc = Nokogiri::HTML(html)
doc.at('p:contains("bar")').text.strip
=> "bar"
Nokogiri can do this (now) using jQuery extensions to CSS:
require 'nokogiri'
html="
<html>
<body>
<p>foo</p>
<p>bar</p>
</body>
</html>
"
doc = Nokogiri::HTML(html)
doc.at('p:contains("bar")').text.strip
=> "bar"