您的位置:首页 > Web前端 > HTML

获取HTML表格内容

2009-05-07 11:10 309 查看
StringBuilder sb = new StringBuilder(256);
MatchCollection mTr = Regex.Matches(yourStr, @"<tr[^>]*>(?:(?!</?tr>)[/s/S])*</tr>", RegexOptions.IgnoreCase);
foreach (Match mr in mTr)
{
MatchCollection mTd = Regex.Matches(mr.Value, @"(?<=<td[^>]*>)[^>]*(?=</td>)", RegexOptions.IgnoreCase);
foreach (Match md in mTd)
{
sb.AppendLine(md.Value);
}
}
Console.WriteLine(sb.ToString());
Console.ReadKey();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: