Forum: Italian Ruby user group Regular expresso: mi sono un pò perso

Posted by Andrea Rossi (masterthebest)
on 2012-09-22 23:41
Ciao a tutti, ho bisogno del vostro aiuto.
Non riesco a ricavare da una pagina html, tutti i link che mi servono,
utilizzando questo script

#main è la pagina scaricata in maniera corretta ed è di tipo String
er=Array.new
er << main['<div id="post_headerC" class="clearfix">(...)</div><hr>']
puts "Post search"
puts "Valore #{er.class}"
for i in er
  puts i
end


Dove Sbaglio???
Posted by Andrea Pavoni (apeacox)
on 2012-09-23 00:35
(Received via mailing list)
Perch non ti appoggi alla gemma nokogiri? :-)

Il giorno sabato 22 settembre 2012, Andrea Rossi ha scritto:
Posted by Andrea Rossi (masterthebest)
on 2012-09-23 09:50
Andrea Pavoni wrote in post #1077137:
> Perch non ti appoggi alla gemma nokogiri? :-)
>
> Il giorno sabato 22 settembre 2012, Andrea Rossi ha scritto:

Ho risolto con hpricot XD
Posted by David Welton (Guest)
on 2012-09-23 10:36
(Received via mailing list)
> Perch non ti appoggi alla gemma nokogiri? :-)

+1

I regexp non vanno bene per parsare HTML.

"Some people, when confronted with a problem, think
I know, I'll use regular expressions.   Now they have two problems. "

--
David N. Welton

http://www.welton.it/davidw/

http://www.dedasys.com/
Posted by Andrea Rossi (masterthebest)
on 2012-09-23 11:14
David Welton wrote in post #1077151:
>> Perch non ti appoggi alla gemma nokogiri? :-)
>
> +1
>
> I regexp non vanno bene per parsare HTML.
>
> "Some people, when confronted with a problem, think
> I know, I'll use regular expressions.   Now they have two problems. "
>
> --
> David N. Welton
>
> http://www.welton.it/davidw/
>
> http://www.dedasys.com/

L'ho notato, infatti sto usando nokogiri (grazie apeacox), in quanto 
hpricot sembra un progetto chiuso/abbandonato.
Posted by Marcello Barnaba (void) (Guest)
on 2012-10-08 13:48
Attachment: PGP.sig (194 Bytes)
(Received via mailing list)
On Sep 23, 2012, at 10:35:48 AM, David Welton wrote:

> I regexp non vanno bene per parsare HTML.
>
> "Some people, when confronted with a problem, think
> I know, I'll use regular expressions.   Now they have two problems. "

Obligatory: http://stackoverflow.com/a/1732454/69379


~Marcello
Posted by Maurizio De magnis (olistik)
on 2012-10-08 14:31
(Received via mailing list)
On 8 October 2012 13:48, Marcello Barnaba (void) <vjt@openssl.it> wrote:

>
> On Sep 23, 2012, at 10:35:48 AM, David Welton wrote:
>
> > I regexp non vanno bene per parsare HTML.
> >
> > "Some people, when confronted with a problem, think
> > I know, I'll use regular expressions.   Now they have two problems. "
>
> Obligatory: http://stackoverflow.com/a/1732454/69379
>

"Chuck Norris *can* parse HTML with regex."

Maurizio
--
My profile <https://plus.google.com/100973969013103507046/about>
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.