keeB Posted March 11, 2008 Share Posted March 11, 2008 I am manually parsing an HTML doc and want to read each row of a table. The HTML I want to gather looks like this: <tr class=mbrow1> <td align=center><img src="/images/boards/closed.gif" border=0 alt="Locked thread"></td> <td>Pinned: <a href="/tool/post/scbbbc/vpost?id=1038138">Message Board Policies - *Please Read*</a></td> <td><a href="/tool/view/mb/profile/scbbbc/Kodiakjo" title="View profile">Kodiakjo</a></td> <td align=center>787</td> <td align=center>0</td> <td> <table cellpadding="0" cellspacing="0" border="0" width="100%" class=mbrow1><tr> <td>04/06/06 at 10:35 AM by <a href="/tool/view/mb/profile/scbbbc/Kodiakjo" title="View profile">Kodiakjo</a></td> <td align="right" nowrap> <a href="/tool/post/scbbbc/vpost?id=1038138&trail=#1"><img src="/images/boards/page.gif" border="0" alt="Go to last post" title="Go to last post"></a></td> </tr></table> </td> </tr> The regex I have so far is: "<tr class=mbrow\d+>(.*)</tr>" That appears to be grabbing the first instance of mbrow1 and grabbing the LAST </tr> How to make it grab first instance of </tr> ? Quote Link to comment Share on other sites More sharing options...
Orio Posted March 11, 2008 Share Posted March 11, 2008 Use the lazy operator - "?". "<tr class=mbrow\d+>(.*?)</tr>" Orio. Quote Link to comment Share on other sites More sharing options...
keeB Posted March 11, 2008 Author Share Posted March 11, 2008 That worked. Thanks Quote Link to comment 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.