200分求一个正则表达式,关于多匹配html元素的,求高人相助

bushido 2004-11-11 11:15:56
<!--item#1 start-->
<table width=100% ><tr><td valign="top">
<table border="0" cellpadding=2 cellspacing=4>
<tr><td width="120">
<Table align="center" border="0" cellpadding="0" cellspacing="1" bgcolor="#cccccc">
<tr><td align=center bgcolor=ffffff height=100 width=100>
<a href="_Photo_Frame.html" target="_blank" title="Glass_Photo_Frame">
<!--要求1.抓取这个图片url-->
<img src="hhjk.jpg" width="100" height="100" border="0" alt="Glas Photo Frame">
</a>
</td></tr></table>
</td>
<td valign="top">
<a href="_Frame.html" target="_blank">Glass Photo Frame</a> <font class=remark> [ Place of Origin:China ]</font>
<br> Specifications: 1) Sizes: 3.5 x 5", 5 x 7", 6 x 8", 8 x 10"   <font class=s>[Related Products: <a name=50105179></a>
<a href="/catalogs/19/Photo_Picture_Frame.html">
Photo & Picture Frame</a>]</font>
<br>
<table width="100%" border="0" cellspacing="7" cellpadding="5">
<tr><td style=padding-left:25px>
<b><a href="/trade/?emberId=Y25maW5lZ2lmdA%3D%3D&encode=Y" target="_blank"><font color=red>41</font> Results</a></b>
from <a href="http://finegift.en.alibaba.com" target=_blank>
Ningbo Finegift Industrial Co., Ltd.</a>
<br><a href="javascript:win=open(oldsuppliers.html', 'forbuyerchina', 'width=730,height=345,location=no,toolbar=no,status=no,resizable=yes,scrollbars=yes'); win.focus();"><img src="uppliers.gif" align="absmiddle" alt="Click here to know more about Gold Supplier!" border=0></a>
<font class=C>
<!--要求2.抓取这个open里的"trust_030325.html"-->
<a href="javascript:win=open(trust_030325.html','','width=445,height=470,location=no,toolbar=no,status=no,resizable=no,scrollbars=no');win.focus();"><img border=0 src="trustpass_logo_s.gif"></a></font>
<a href="javascript:win=open(how/~~cnfinegift?smallwin', '', 'width=380,height=466,location=no,toolbar=no,status=no,resizable=no,scrollbars=yes'); win.focus();"><img src="/chinasupply/video3.gif" border=0></a>
</font>
</td>
</tr></table>
</td>
<td valign=top nowrap class=s width="100"><input type="checkbox" value="50105179" name="chkProductIds" > Select
</td>
</tr></table>
<!--item#1 end-->
<!--item#2 start-->
<!--item#2 end-->
有很多类似的item#部分,
<!--要求1.抓取这个图片url-->
<!--要求2.抓取这个open里的"trust_030325.html"-->
急用....
...全文
280 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
bushido 2004-11-14
  • 打赏
  • 举报
回复
哎,自己解决了
zhn0410 2004-11-11
  • 打赏
  • 举报
回复
占个位学习,并帮你顶一下。
bushido 2004-11-11
  • 打赏
  • 举报
回复
Regex re = new Regex(@"这里怎么写");
foreach (Match m in re.Matches(str)){
Console.WriteLine(m.Groups["xxxx"].Value);
Console.WriteLine(m.Groups["yyyy"].Value);
}
//这里的,xxxx,yyyy怎么对应
bushido 2004-11-11
  • 打赏
  • 举报
回复
string target = @"^<(table)\s+.*>.*<(table)\s+.*>.*<img\s+src\s*=""(?<img>)""\s+.*>.*</table></table>$";
我改成這樣還是不行呀
bushido 2004-11-11
  • 打赏
  • 举报
回复
哎,我是急用才,
教程我也在看
leisang 2004-11-11
  • 打赏
  • 举报
回复
网上教程很多了,自己搜一下
search.csdn.net
bushido 2004-11-11
  • 打赏
  • 举报
回复
string target = @"<(table)\s+[.\n]*>[.\n]*<(table)\s+[.\n]*>[.\n]*<img\s+src\s*=""(?<img>)""\s+[.\n]*>[.\n]*<\/.*><\/table.*>";
我这样写能不能匹配
bushido 2004-11-11
  • 打赏
  • 举报
回复
up,help me

62,041

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧