From: Joel Pearson Date: 2013-03-28T02:55:27+09:00 Subject: Re: Nokogiri help parsing HTML Just out of curiosity I had a go at writing this myself, with the exception of that complicated xpath because I don't really understand xpath yet :) This is what I came up with: require 'nokogiri' doc = Nokogiri::HTML File.read(ARGV[0]) output = doc.css('span[@id="date"]').first.text[/\d+ \w+ \d+/].gsub(' ','-') + $/ 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/.