Using regex to strip out certain data from HTML code via PHP

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-04-03T17:58:21Z Indexed on 2010/04/03 18:03 UTC
Read the original article Hit count: 140

Filed under:
|

I have the following HTML snippet

<tr>
<td class="1">...</td>
<td class="2">...</td>
<td class="3">...</td>
<td class="4">...</td>
</tr>
etc...

I basically have N rows, and each row contains 4 TD's each with a unique class. I would like a simple way to split out all the rows and TD's by class so I can choose what data I want to use.

I expect the easiest way to achieve this would be regex (maybe two). One to split up the TR's then another to split up the TDs (by class preferably)

Thanks

© Stack Overflow or respective owner

Related posts about regex

Related posts about php