源码:
<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了
<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了
解决方案 »
- 求几个项目的技术说辞?谁帮帮忙..........
- 伪静态的正则规则小问题,你们都会的,就我不会,,,急死人,在线等大侠来救命
- MYSQL update 语句问题
- 关于textbox的textmode为password 的问题?????
- 关于自定义控件数据回传的问题?请指教!!
- web 站点只能建在默认的站点上面吗?如果不是应怎么做呢?
- asp.net里有啥办法可以显示ole字段?
- 怎么用asp.net 调用orcale 的存储过程?
- 如何输入内容至<head></head>内?
- ===只有10分了,请问怎么把txt或word转换成传真格式(tif或fax),谢谢===
- 求一份使用VS2005或vs2010制作手机网站的教程
- asp.net js 无法获得cookie值
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啊
<td>文章内容aaa<br>文章内容bbbccc<p>文章内容ddd</p><div align="right">
时间:2013-08-08
</div> </td>
</tr>
</table></td>
<tr>
<td>文章内容aaa<br>文章内容bbbccc<p>文章内容ddd</p><div align="right">
时间:2013-08-08
</div> </td>
</tr>
</table></td>