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 = <<EOF
      4	<tr>
      5	  <td>type</td><td>id=M_btn_Mainl00</td><td>home</td>
      6	</tr>
      7	<tr>
      8	  <td id='something'>clickAndWait</td>
      9	  <td>id=M_ct200_MainContent</td>
     10	  <td></td>
     11	</tr>
     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"
""


-- 
<https://github.com/stomar/>