Possible Duplicate:
Best methods to parse HTML with PHP
for example i have a html code like :
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="rowData">
<tr align="center" class="fnt-vrdana-mavi" >
<td style="font-size:11px" colspan=3><b>Text text text</b>:3</td>
</tr>
<tr class="header" align="center">
<td height="18" colspan="3">Text text text</td>
</tr>
<tr align="center" class="fnt-vrdana" bgcolor="#eff3f4" height="18">
<td width="32%" height="17"><b>1</b></td>
<td width="34%"><b>0</b></td>
<td width="34%"><b>2</b></td>
</tr>
<tr align="center" class="fnt-vrdana-mavi">
<td height="17">2.90</td>
<td>3.20</td>
<td>1.85</td>
</tr>
</table>
Which is best regular expression to match all data from inside <td> tags?
I normally suggest if you need to actually express what you’re looking for in a HTML document to use an
xpathexpression for that because it can give you the actual value whereas regex’es are not able to further parse the HTML/XML, andxpathexpressions are much more fine-grained. See the output which returns the text-value for example w/o any further tags inside:Code: