正则表达式提取网页内容 如何提取用正则表达式提取 蜡笔小新 四个字啊 ??<TD class=tableGhf width=370 colSpan=3 widtd="50%">蜡笔小新</TD> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <TD class=tableGhf width=370 colSpan=3 widtd="50%">张三 </TD> <TD class=tdbg1 width=113 widtd="17%">登证证书编号 </TD> <TD class=tableGhf width=101 widtd="17%">未填写 </TD> </TR> <TD class=tdbg1 width=102 widtd="13%">住址 </TD> <TD class=tableGhf width=370 colSpan=3 height=20 widtd="50%">北京 </TD> <TD class=tdbg1 width=113 widtd="17%">状态 </TD> <TD class=tableGhf width=101 height=20 widtd="17%">违法未处理 </TD> 怎么用正则表达式提取上面的 张三 登证证书编号 未填写 。 等文字 string html = @"<TD class=tableGhf width=370 colSpan=3 widtd=""50%"">张三 </TD><TD class=tdbg1 width=113 widtd=""17%"">登证证书编号 </TD><TD class=tableGhf width=101 widtd=""17%"">未填写 </TD> </TR><TD class=tdbg1 width=102 widtd=""13%"">住址 </TD><TD class=tableGhf width=370 colSpan=3 height=20 widtd=""50%"">北京 </TD><TD class=tdbg1 width=113 widtd=""17%"">状态 </TD><TD class=tableGhf width=101 height=20 widtd=""17%"">违法未处理 </TD> "; Regex reg = new Regex(@"(?is)(?<=>)[^<]+(?=<)"); MatchCollection mc = reg.Matches(html); Console.WriteLine("/*\n------输出结果------------"); foreach (Match m in mc) { Console.WriteLine( m.Groups[0].ToString()); } Console.WriteLine("*/"); /* ------输出结果------------ 张三 登证证书编号 未填写 住址 北京 状态 违法未处理 */ 再麻烦您一下 我要是只提取带 这个 <TD class=tableGhf 标记 内容怎么写正则表达式啊?? 能不能一次说完啊?........ string html = @"<TD class=tableGhf width=370 colSpan=3 widtd=""50%"">张三 </TD><TD class=tdbg1 width=113 widtd=""17%"">登证证书编号 </TD><TD class=tableGhf width=101 widtd=""17%"">未填写 </TD> </TR><TD class=tdbg1 width=102 widtd=""13%"">住址 </TD><TD class=tableGhf width=370 colSpan=3 height=20 widtd=""50%"">北京 </TD><TD class=tdbg1 width=113 widtd=""17%"">状态 </TD><TD class=tableGhf width=101 height=20 widtd=""17%"">违法未处理 </TD> "; Regex reg = new Regex(@"(?is)<TD\sclass=tableGhf.*?>([^<]+)</TD>"); MatchCollection mc = reg.Matches(html); Console.WriteLine("/*\n------输出结果------------"); foreach (Match m in mc) { Console.WriteLine( m.Groups[1].ToString()); } Console.WriteLine("*/"); /* ------输出结果------------ 张三 未填写 北京 违法未处理 */ <TD class=tableGhf width=370 colSpan=3 widtd="50%">(*.?) </TD> 我想问下widtd="50%"是什么意思的 我的sql server2008 本地服务器显示空 c#动态生成txt文档 关于程序发布的问题 数据排列 C#能否读取光驱里的文件,怎么读取? 怎样把域名指向我的虚拟目录 C#2005,flash8b.ocx组件如何播放flash? 为什么在解决方案或项目上按鼠标右键,将项目/解决方案添加进源代码管理 的选项? C# 将datatable更新到原数据库中 SQL TCP被动接受数据 请高手帮忙看看 我这个程序 为什么结果总是负数。。 两百分,请教一个VB的问题
<TD class=tdbg1 width=113 widtd="17%">登证证书编号 </TD>
<TD class=tableGhf width=101 widtd="17%">未填写 </TD> </TR>
<TD class=tdbg1 width=102 widtd="13%">住址 </TD>
<TD class=tableGhf width=370 colSpan=3 height=20 widtd="50%">北京 </TD>
<TD class=tdbg1 width=113 widtd="17%">状态 </TD>
<TD class=tableGhf width=101 height=20 widtd="17%">违法未处理 </TD>
怎么用正则表达式提取上面的 张三 登证证书编号 未填写 。 等文字
<TD class=tdbg1 width=113 widtd=""17%"">登证证书编号 </TD>
<TD class=tableGhf width=101 widtd=""17%"">未填写 </TD> </TR>
<TD class=tdbg1 width=102 widtd=""13%"">住址 </TD>
<TD class=tableGhf width=370 colSpan=3 height=20 widtd=""50%"">北京 </TD>
<TD class=tdbg1 width=113 widtd=""17%"">状态 </TD>
<TD class=tableGhf width=101 height=20 widtd=""17%"">违法未处理 </TD> ";
Regex reg = new Regex(@"(?is)(?<=>)[^<]+(?=<)");
MatchCollection mc = reg.Matches(html);
Console.WriteLine("/*\n------输出结果------------");
foreach (Match m in mc)
{
Console.WriteLine( m.Groups[0].ToString());
} Console.WriteLine("*/"); /*
------输出结果------------
张三
登证证书编号
未填写 住址
北京
状态
违法未处理
*/
string html = @"<TD class=tableGhf width=370 colSpan=3 widtd=""50%"">张三 </TD>
<TD class=tdbg1 width=113 widtd=""17%"">登证证书编号 </TD>
<TD class=tableGhf width=101 widtd=""17%"">未填写 </TD> </TR>
<TD class=tdbg1 width=102 widtd=""13%"">住址 </TD>
<TD class=tableGhf width=370 colSpan=3 height=20 widtd=""50%"">北京 </TD>
<TD class=tdbg1 width=113 widtd=""17%"">状态 </TD>
<TD class=tableGhf width=101 height=20 widtd=""17%"">违法未处理 </TD> ";
Regex reg = new Regex(@"(?is)<TD\sclass=tableGhf.*?>([^<]+)</TD>");
MatchCollection mc = reg.Matches(html);
Console.WriteLine("/*\n------输出结果------------");
foreach (Match m in mc)
{
Console.WriteLine( m.Groups[1].ToString());
} Console.WriteLine("*/"); /*
------输出结果------------
张三
未填写
北京
违法未处理
*/