[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: parsing HTML code with regex

Gavin Kistner

10/24/2006 6:51:00 PM

From: Gavin Kistner
> From: Anthony Walsh
> > Sent: Tuesday, October 24, 2006 12:35 PM
> > I'm trying to count and print each <tr> and <tr 'something'>.
>
> Do you just want to match the "<tr>", or do you want to match the
> "<tr>...</tr>"?
>
> Assuming the former:
> row_tags = op_file.scan( /<tr[^>]+>/ )
> p row_tags, row_tags.length

Er, oops. I mean /<tr[^>]*>/ of course, to match the no-attribute row as
well.