Skip to content

Instantly share code, notes, and snippets.

@flavorjones
Created April 20, 2009 01:06
Show Gist options
  • Save flavorjones/98306 to your computer and use it in GitHub Desktop.
Save flavorjones/98306 to your computer and use it in GitHub Desktop.
#! /usr/bin/ruby
require 'rubygems'
require 'nokogiri'
HTML = '<b>http://foo.com/</b><i>http://bar.com</i><b>no match here</b>'
doc = Nokogiri::HTML(HTML)
puts doc.xpath("//b[contains(text(),'http')]") # => <b>http://foo.com/</b>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment