From: Srijayanth Sridhar Date: 2008-07-25T16:44:02+09:00 Subject: Re: Regexp Ruby selection Any specific reason you can't use hpricot or other HTML parsers? Jayanth On Fri, Jul 25, 2008 at 1:09 PM, touffik@gmail.com wrote: > Hi folks, > I'm trying to code a ruby script that select the content of a HTML > table in a HTML page. > I used rubular to test my regexp syntax which is > / ]*>(.*)  / > with rubular the result of my expression is : > Result 1 > 1. 12345678 > Result 2 > 1. SAN FRANCESCO DA PAOLA > Result 3 > 1. Via San Francesco Da Paola, 10 > Result 4 > 1. 10123 > Result 5 > 1. TORINO > etc.... > But with my script : > > File.open('D:/testt/1.txt', 'r') do |filein| > > while line = filein.gets > p line if line =~ /]*>/ .. line > =~ /\/A / > end > fileout.puts p > end > end > > I got this result > "12345678 \n" > "SAN FRANCESCO DA PAOLA  td>\n" > "Via San Francesco Da Paola, > 10 \n" > "10123 \n" > "TORINO \n" > > I thought the .. between 2 "line =~" was like (...) in rubular which > let catch the content ?? > Moreover I would like to transform this html code in XML. But I can"t > find an idea how to transform these HTML line in XML. > > 12345678 > But there is no attribut 'name' or wathever in the so making and > match/replace would be difficult ? > .. > > So, if someone can help me I would be very grateful. > Nice day ;) > >