110,561
社区成员
发帖
与我相关
我的任务
分享
private static void TestRegex03()
{
string html = Encoding.GetEncoding("GB2312").GetString(new WebClient().DownloadData("http://www.zjlottery.com/win/winL.asp?newsid=64291"));
Match m = Regex.Match(html, @"(?is)“(?<wf>超级大乐透35选5加12选2”第 \d+ 期).+?(?<qgtz>全国投注总额:[^元]+元).+?(.+? (?<ball>\d{2}).+?)+.+?</table>");
if (!m.Success) return;
Console.WriteLine(m.Groups["wf"].Value.Replace(" ", " "));
Console.WriteLine(m.Groups["qgtz"].Value.Replace(" ", " "));
foreach (Capture c in m.Groups["ball"].Captures)
{
Console.Write(c.Value + " ");
}
}
static void Main(string[] args)
{
string html = Encoding.GetEncoding("GB2312").GetString(new WebClient().DownloadData("http://www.zjlottery.com/win/winL.asp?newsid=64291"));
Match m = Regex.Match(html, @"(?is)“(?<wf>超级大乐透35选5加12选2”第 10077 期).+?(?<qgtz>全国投注总额:[^元]+元).+?(.+? (?<ball>\d{2}).+?)+.+?</table>");
if (!m.Success) return;
Console.WriteLine(m.Groups["wf"].Value.Replace(" ", " "));
Console.WriteLine(m.Groups["qgtz"].Value.Replace(" ", " "));
foreach (Capture c in m.Groups["ball"].Captures)
{
Console.Write(c.Value + " ");
}
Console.ReadKey();
}
超级大乐透35选5加12选2”第 10077 期
全国投注总额: 51385724元
6 07 09 17 24 02 12