求一正则

c02645 2009-06-09 11:47:04
<tr>
<td height="25" class="liebiao"><div align="center"></div></td>
<td height="25" class="liebiao"><a href="../Company/Info/Com_Job.asp?Comid-VR6vocvz4ykq5811-Param-28551.html"

target="_blank" class="a1">总经理</a> </td>
<td height="25" class="liebiao"><a href="../Company/Info/Com_View.asp?Param-VR6vocvz4ykq5811.html"

target="_blank"class="a1">宁波银亿集团有限公司</a><img src="../person/Images/Vip.gif" align="absmiddle"></td>
<td height="25" class="liebiao">2009-6-9 9:05:00</td>
<td height="25" class="liebiao">广西</td>
</tr>


取得<td height="25" class="liebiao">/td>内的内容放到string[] 里面
...全文
109 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
windstore 2009-06-09
  • 打赏
  • 举报
回复

public string[] GetContentList(string source)
{
List<string> list = new List<string>();
Regex re = new Regex(@"<td\s+height=\""25\""\s+class=\""liebiao\"">(?<Content>[\s\S]+?)</td>", RegexOptions.IgnoreCase);
MatchCollection mc = re.Matches(source);
foreach (Match ma in mc)
{
list.Add(ma.Groups["Content"].Value);
}
return list.ToArray();
}
c02645 2009-06-09
  • 打赏
  • 举报
回复
就是第一个<td>开始到第一个</td>结束,它们之间的内容

111,095

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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