From: Paul Mena Date: 2013-03-30T01:39:29+09:00 Subject: Re: Nokogiri help parsing HTML That makes quite a difference! Here's what I have after ripping out the old logic and extracting the date using Nokogiri: #!/usr/bin/env ruby require "nokogiri" # get the date doc = Nokogiri::HTML File.read(ARGV[0]) output = doc.css('span[@id="date"]').first.text[/\d+ \w+ \d+/].gsub(' ','-') + $/ # get the remaining text path = '//address/following-sibling::p//text()' doc.xpath(path).each { |line| output << line.text.strip << $/ } File.write("snippet.txt", output) -- Posted via http://www.ruby-forum.com/.