REGEX Question

Status
Not open for further replies.

grandcartel

Grand Cartel Properties
Jan 28, 2007
55
1
0
Queens, NYC
Alright, so basically I'm trying to scrape a lyrics site.

The HTML on the site looks like this

Code:
<TD rowspan=2>
<a href="blahblah">test</a><br>
<a href="blahblah">test</a><br>
<a href="blahblah">test</a><br>
<a href="blahblah">test</a><br></TD>
</TR>
What expression should I use for this? I'm using
Code:
<TD rowspan=2 (.*)>(.*)</TD>
        </TR>|s
but it doesn't seem to work.

Any suggestions are appreciated :)
 


Now I'm using
Code:
<TD rowspan=2 valign=top width=33% bgColor=#0c1f50 valign=top>(.*)</TD>|s/

It works, but any ideas for improvement?
 
Code:
<TD.*>(.*)</TD>|s/

Of course, that will get you every td.... awwwwhhh but you need to tell us what identifies the correct TDs.

::emp::
 
Code:
<TD.*>(.*)</TD>|s/
Of course, that will get you every td.... awwwwhhh but you need to tell us what identifies the correct TDs.

::emp::
Yeah, I realized that, stupid mistake. I ended up doing
PHP:
    preg_match("|<TD rowspan=2 valign=top width=33% bgColor=#0c1f50 valign=top>(.*?)</TD>|s", $build, $result);
 
Status
Not open for further replies.