C#(正则表达式筛选网页指定数据)
http://we.sportscn.com/viewnews-1415234.html我要筛选到这个网址上面的
这一块内容的HTML源码,求正则表达式呀???xpath也可以...求高手帮忙呀感激不尽!
楼上的编码你弄错了.是gbk
[解决办法]
正则中的 ' " 不要乱改.......................................................................................................................................................................................谁说了 ' " 在正则里面是一样的..
[解决办法]
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.GetEncoding("GBK");
string str = wc.DownloadString("http://we.sportscn.com/viewnews-1415234.html");
MatchCollection mc = Regex.Matches(str, "<UL class=title>([\\s\\S]+?)<div id="ad4" class="ad4" style="display:none;">");
foreach (Match item in mc)
{
Console.WriteLine(item.Groups[1].Value);
}