From: sto.mar@... Date: 2012-11-10T05:26:22+09:00 Subject: Re: Ruby script to process html Am 09.11.2012 19:40, schrieb Mario Trento: > Thanks, all guys. > I"ll start with line proc I think, still not quite in oop. Thanks all > for your help, this structure is very solid, and won't change it's > actually Selenium scripts.html Sometimes a little more effort at the beginning pays off in the long run... See a hint for a solution using Nokogiri below. Note that it is even simpler (in my opinion) than iterating through lines and using regular expressions and that it handles HTML that is more complicated than your example. Disclaimer: I have never used Nokogiri before, and spent about ten minutes on this, based on the simplest examples on nokogiri.org, so it's probably wrong and/or clumsy and others could provide much better solutions to your problem. $ cat -n extract_data.rb 1 require 'nokogiri' 2 3 html = < 5 typeid=M_btn_Mainl00home 6 7 8 clickAndWait 9 id=M_ct200_MainContent 10 11 12 EOF 13 14 doc = Nokogiri::HTML.parse(html) 15 16 doc.xpath('//td').each do |cell| 17 puts cell.content.inspect 18 end $ ruby extract_data.rb "type" "id=M_btn_Mainl00" "home" "clickAndWait" "id=M_ct200_MainContent" "" --