0

In my HTML text I want to ignore two (2) </tr>'s and capture text from the start to the third </tr>, my pattern is

 string regularExpressionPattern = @"\<tr class=(.*?)\</tr>";

And here is the input text.

<tr class="oddrow">
  <td>5Dimes.eu</td>
  <td style="text-align:center;">
    <table cellspacing="1" cellpadding="3" class="tablehead">
    <tr>
      <td width="50%" style="text-align:right;">SF: -3<br/>STL: +3</td>
      <td style="text-align:left;">-111<br/>+101</td>
    </tr>
    </table>
  </td>
  <td style="text-align:center;">
    <table cellspacing="1" cellpadding="3" class="tablehead">
    <tr>
      <td width="50%">41.5 O/U</td>
      <td width="50%">o: -106<br/>u: -104</td>
    </tr>
    </table>
  </td>
  <td style="text-align:center;">SF: -160<br/>STL: 150</td>
  </tr>

As you can see, there are three (3) </tr> tags.
How can I adjust my pattern to use the third tag rather than the first one?

Thanks

4

2 回答 2

0

尝试使用这个正则表达式:

<tr class=.*?(<tr>.*?</tr>.*?)*</tr>
于 2013-09-25T14:16:27.160 回答
0

只需使用

@"\<tr class=((.*?)\</tr>){3}"

于 2013-09-25T14:02:24.220 回答