110,536
社区成员
发帖
与我相关
我的任务
分享
<td id='8888888888888888' align="center" colspan="8"
bgcolor="#cccccc">
.......................................
<div id="dgReshop_di"><table cellspacing="1" cellpadding="1" width="100%" align="center" border="0"><tr style='background-color:#F7F7F7;height:13px;' bgcolor='#F7F7F7'><td align="center" width="30%">测试项目</td>...............<td bgcolor='white' align="center">固定名称-输出内容二</td><td align="center">0</td><td align="center">15888888888</td></tr></table></div>
</td>
</tr>
</td>
</tr><tr>
<td>
static void Main(string[] args)
{
string test = @"<td id='8888888888888888' align=""center"" colspan=""8""
bgcolor=""#cccccc"">
.......................................
<div id=""dgReshop_di""><table cellspacing=""1"" cellpadding=""1"" width=""100%"" align=""center"" border=""0""><tr style='background-color:#F7F7F7;height:13px;' bgcolor='#F7F7F7'><td align=""center"" width=""30%"">测试项目</td>...............<td bgcolor='white' align=""center"">固定名称-输出内容二</td><td align=""center"">0</td><td align=""center"">15888888888</td></tr></table></div>
</td>
</tr>
</td>
</tr><tr>
<td>";
MatchCollection mc = Regex.Matches(test, @"(?ins)<td id='(?<id>[^']+).+?<td bgcolor='white' align=""center"">(?<item1>[^<]+)([^>]+>){4}(?<mobile>\d+)");
foreach(Match m in mc)
{
Console.WriteLine(m.Groups["id"].Value);
Console.WriteLine(m.Groups["item1"].Value);
Console.WriteLine(m.Groups["mobile"].Value);
}
Console.ReadKey();
}
static void Main(string[] args)
{
string test = @"<td id='8888888888888888' align=""center"" colspan=""8""
bgcolor=""#cccccc"">
.......................................
<div id=""dgReshop_di""><table cellspacing=""1"" cellpadding=""1"" width=""100%"" align=""center"" border=""0""><tr style='background-color:#F7F7F7;height:13px;' bgcolor='#F7F7F7'><td align=""center"" width=""30%"">测试项目</td>...............<td bgcolor='white' align=""center"">固定名称-输出内容二</td><td align=""center"">0</td><td align=""center"">15888888888</td></tr></table></div>
</td>
</tr>
</td>
</tr><tr>
<td>";
Match m = Regex.Match(test, @"(?ins)<td id='(?<id>[^']+).+?<td bgcolor='white' align=""center"">(?<item1>[^<]+)([^>]+>){4}(?<mobile>\d+)");
if(!m.Success) return;
Console.WriteLine(m.Groups["id"].Value);
Console.WriteLine(m.Groups["item1"].Value);
Console.WriteLine(m.Groups["mobile"].Value);
Console.ReadKey();
}