<table>
<tr>
<td></td>
</tr>
</table>
<table>
<tr>
<td></td>
</tr>
</table>
<table>
<tr>
<td></td>
</tr>
</table>
<table>
<tr>
<td></td>
</tr>
</table>
写一个正则表达式   匹配 单个 <table></table>  不知道 我的意思表明白了?

解决方案 »

  1.   


      string str = "<table><tr><td></td></tr></table><table><tr><td></td></tr></table><table><tr><td></td></tr></table><table><tr><td></td></tr></table>";
            Regex re = new Regex(@"<table>.*?</table>", RegexOptions.None);    
            MatchCollection mc = re.Matches(str);        string text = string.Empty;
            foreach (Match ma in mc)
            {
                text += ma.Value + "____"; //ma.Value就是你要的一组组Table
            }
      

  2.   

    (?is)<table>((?!</table>).)*?</table>
      

  3.   

    (?is)<table>.*?</table>