日期:2014-05-17  浏览次数:20853 次

C#(正则表达式筛选指定数据)
http://soccer.titan24.com/2013-11-27/247638.html大家看一下这个网址,我要只筛选到这些内容的HTML源码,求正则表达式怎么写呀?求大神帮忙...感激不尽!
正则表达式 C# 数据筛选 winfrom

------解决方案--------------------
用正则截取“<div class="atxt f14" id="atxt">......</div>”中间的东东,然后截取纯文本的前多少多少个字符。
------解决方案--------------------
var reg=new Regex(@"(?is)<div class=""atxt f14"" id=""atxt"">.*?(?=\s+<div class=""txtlist""");

string result=reg.Match(yourhtml).Value;
------解决方案--------------------
var reg=new Regex(@"(?is)<div class=""atxt f14"" id=""atxt"">.*?(?=\s+<div class=""txtlist"")");

少打了一个右括号
------解决方案--------------------

var reg = new Regex(@"<div class=""atxt f14"" id=""atxt"">(?is:(?<Content>.*?))(?=\s+<div class=""txtlist"")");
 
                Match math = reg.Match(str);
                Console.WriteLine(math.Groups["Content"].Value);

------解决方案--------------------
http://htmlagilitypack.codeplex.com/   试试这个,HTML解析,方法绝大类似xmlDocumentm,用 xpath