From: Shadowfirebird Date: 2008-07-25T16:49:53+09:00 Subject: Re: Regexp Ruby selection I'll second that. Hpricot is really quite remarkable. It'll almost certainly save you days and days of pain. Unless you are doing this for fun / learning, of course. On Fri, Jul 25, 2008 at 8:44 AM, Srijayanth Sridhar wrote: > 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 ;) >> >> > > -- Me, I imagine places that I have never seen / The colored lights in fountains, blue and green / And I imagine places that I will never go / Behind these clouds that hang here dark and low But it's there when I'm holding you / There when I'm sleeping too / There when there's nothing left of me / Hanging out behind the burned-out factories / Out of reach but leading me / Into the beautiful sea