日期:2014-05-19  浏览次数:20782 次

最里層正則匹配
<table>
  <table>
    <table>
      <tr> <td> a </td> </tr>
    </table>
  </table>
</table>


求最里層正則匹配的寫法
如上所示,怎樣得到
    <table>
      <tr> <td> a </td> </tr>
    </table>

即最里層 <table> </table> 內容


------解决方案--------------------
<table(\s+[^> ]+)?> (?![\s\S]* <table(\s+[^> ]+)?> )[\s\S]*? </table>