I have
<table id="needle"><tr><td>X</td></tr><table>...</table><table>...</table></table>
I found X position, then I found < position of #needle table, and how to find position of last > pair #needle tag
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
you could use html5lib. Less recommended but works too: YQL by yahoo
EDIT: removed regex because of comments.
The probably best overview had gordon listed in his comment:
How do you parse and process HTML/XML in PHP?