From: Mark Thomas Date: 2009-02-12T02:03:50+09:00 Subject: Re: regexp problem As long as we're being pedagogical, I prefer XPath to all the previous posted solutions. * More accommodating to minor changes in the HTML * Very short (one-liner) and easy to read (IMHO) require 'nokogiri' doc = Nokogiri::HTML(html) puts doc.xpath('//td[contains(.,"Traffic left")]/following- sibling::td//script').to_s.scan(/Math.ceil.-(\d*)/)