shedokan Posted June 25, 2009 Share Posted June 25, 2009 I have this regex: preg_match_all('|<tr([^<>]*)><td>([^&]*)([^<>]*)</td><td([^>]*)>([^&]*)([^<>]*)</td><td([^>]*)>([^&]*)([^<>]*)</td><td([^>]*)>([^&]*)([^<>]*)</td></td></tr>|', $table, $stats, PREG_SET_ORDER); it needs to allow a table inside the first <td>([^&]*)([^<>]*)</td> but I don't know how to do that. please help me. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/163707-a-table-or-a-string-inside-a-td/ Share on other sites More sharing options...
Ken2k7 Posted June 26, 2009 Share Posted June 26, 2009 What is the regex checking for? Quote Link to comment https://forums.phpfreaks.com/topic/163707-a-table-or-a-string-inside-a-td/#findComment-863824 Share on other sites More sharing options...
shedokan Posted June 26, 2009 Author Share Posted June 26, 2009 it is looking for rows like this: <tr bgcolor=#402020><td><table cellpadding=0 cellspacing=0 border=0 width=99%><tr><td>06/25/09 Thu*</td></tr></table></td><td align=right>2 </td><td align=right>1 </td><td align=right>0 </td></td></tr> but they can sometimes be like this, without the table: <tr bgcolor=#402020><td>06/25/09 Thu*</td><td align=right>2 </td><td align=right>1 </td><td align=right>0 </td></td></tr> Quote Link to comment https://forums.phpfreaks.com/topic/163707-a-table-or-a-string-inside-a-td/#findComment-863831 Share on other sites More sharing options...
.josh Posted June 26, 2009 Share Posted June 26, 2009 regex is not really that great at dealing with nested tags. You should look into DOM. Quote Link to comment https://forums.phpfreaks.com/topic/163707-a-table-or-a-string-inside-a-td/#findComment-863850 Share on other sites More sharing options...
shedokan Posted June 26, 2009 Author Share Posted June 26, 2009 I tried that once, but it's too cmplicated for me. if someone could give me an example of how to do this, I can take things from there. Quote Link to comment https://forums.phpfreaks.com/topic/163707-a-table-or-a-string-inside-a-td/#findComment-864015 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.