源码:
<table><tr> 
                      <td><table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
                          <tr> 
                            <td height="33" align="center" bgcolor="#EBEBEB" class="t16">文章标题 </td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr> 
                      <td height="8" align="center" valign="top" bgcolor="#FAFAFA"><table width="95%" border="0" cellspacing="0" cellpadding="0">
                          <tr> 
                            
          <td>文章内容aaa<br>文章内容bbbccc<p>文章内容ddd</p><div align="right">
 时间:2013-08-08  
</div>  </td>  
                          </tr>  
                        </table></td>  
                    </tr>  
                  </table>  我正则是这样写的asp.net代码://截取内容
            string content="";
            string contentS="<td height=\"8\" align=\"center\" valign=\"top\" bgcolor=\"#FAFAFA\">";
            
            string contentE = "</td>";            string pc = @"" + contentS + ".+?" + contentE;
            Regex rec = new Regex(pc, RegexOptions.IgnoreCase);
            MatchCollection mct = rec.Matches(HtmlCode);            if (mct.Count > 0)
            {                content = o.RegReplace(mct[0].ToString().Trim(), contentS, contentE);
            }
  但是mct.Count为0了

解决方案 »

  1.   

    string contentS="(?is)<td height=\"8\" align=\"center\" valign=\"top\" bgcolor=\"#FAFAFA\">";
      

  2.   

    //截取标题
                string titleS = "<td height=\"33\" align=\"center\" bgcolor=\"#EBEBEB\" class=\"t16\">";
                string titleE = "</td>";            string p = @"" + titleS + ".+?" + titleE;
                Regex re = new Regex(p, RegexOptions.IgnoreCase);
                MatchCollection mc = re.Matches(HtmlCode);            string title = o.RegReplace(mc[0].ToString().Trim(), titleS, titleE);
    我用这个可以截取标题的,这里我没加is啊
      

  3.   

       <td height="33" align="center" bgcolor="#EBEBEB" class="t16">文章标题 </td>知道什么是换行符么?
       <td>文章内容aaa<br>文章内容bbbccc<p>文章内容ddd</p><div align="right">
     时间:2013-08-08  
    </div>  </td>  
                              </tr>  
                            </table></td>  
      

  4.   

      <td height="8" align="center" valign="top" bgcolor="#FAFAFA"><table width="95%" border="0" cellspacing="0" cellpadding="0">
                              <tr> 
                                
              <td>文章内容aaa<br>文章内容bbbccc<p>文章内容ddd</p><div align="right">
     时间:2013-08-08  
    </div>  </td>  
                              </tr>  
                            </table></td>