in reply to Re: multiple regex matching
in thread multiple regex matching
I am scraping a web page and I have $source which is the html dump. From the entire source code there is a table that has a ton of rows but always 2 columns (as you can see from the two samples above.
There is 1 URL in each table cell which means 2 URLS per table row. I need to collect the URL and the text of the URL for EACH table cell (which means 2 urls per row).
Those 2 samples displayed in the OP is what the table looks like. There's dozens upon dozens of <TR>s and I need to extract each url and the text for it and at the same time keep each row of links connected. This is to say I need to keep the two URLS per row together somehow because they are relative to each other. This code is the beginning of the table and 3 rows. You see it's just the same type of code I pasted earlier. I need the urls and the text but keep each row of data together magically.
From that code I want to get /my-bloody-valentine-rxzg3.html and My Bloody Valentine from the first cell from the first table and ="/my-bloody-valentine-rxzg3.html and Lovely Sweet Darlene . I need this data collected for each row.<TABLE width=468 style="border-collapse:collapse"><TR><TD><TABLE width +=468 style="border-collapse:collapse" cellpadding=2> <TR><TD class=he +ad>Artist</TD><TD class=head>Song</TD></TR> <TR class=g><TD class=i><A href="/my-bloody-valentine-rxzg3.html">My B +loody Valentine</A></TD><TD class=j><A href="/my-bloody-valentine-lov +ely-sweet-darlene-9lgrnkb.html">Lovely Sweet Darlene *</A></TD></TR> <TR class=h><TD class=i><A href="/jennifer-love-hewitt-d193f.html">Jen +nifer Love Hewitt</A></TD><TD class=j><A href="/jennifer-love-hewitt- +i-want-a-love-i-can-see-jv2mj67.html">I Want A Love I Can See *</A></ +TD></TR> <TR class=g><TD class=i><A href="/jennifer-love-hewitt-d193f.html">Jen +nifer Love Hewitt</A></TD><TD class=j><A href="/jennifer-love-hewitt- +no-ordinary-love-4rftntr.html">No Ordinary Love *</A></TD></TR>
Does this make any more sense?
Edited by Chady -- escaped <TR>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: multiple regex matching
by Cody Pendant (Prior) on Apr 14, 2005 at 01:22 UTC |