Page 1 of 1

Stuck with a pattern...

Posted: Mon Mar 06, 2006 9:30 am
by welsh_sponger
I need to match from this html

$html = ...<td>&nbsp; &nbsp; &nbsp; 04:04 <span class="redtext"> 2.09m</span></td>...

the value 2.09 in two matches, 2 then 09

my pattern so far...

Code: Select all

preg_match( "#\s+(\w{2})\:(\w{2})\s+[\<](\w{4}\s\w{5}[\=\w{9}\>\s+])#im", $html, $match);
which works up to the end of the "redtext"> part but cannot match the values I want from here, tried lots but cant work it out. Also i thought about trying the match from "redtext"> straight off, but its the second occurence of this.

If anyone could tell me what i need to add to my current code that would be extremly helpful.

Thanks

Posted: Mon Mar 06, 2006 9:38 am
by feyd

Code: Select all

#<\s*td[^<>]*>(?:&nbsp;|\s)*\d{2}:\d{2}(?:&nbsp;|\s)*<\s*[a-z]+\s+[^<>]*?redtext[^<>]*>\s*(\d (\.\d )?\s*[a-z])#s
:?: