Jump to content

Simple Regex I can't get right


keeB

Recommended Posts

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> ?

 

Link to comment
https://forums.phpfreaks.com/topic/95641-simple-regex-i-cant-get-right/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.