哪位能给下提取百度搜索结果(标题和链接)的正则表达式
哪位能给下提取百度搜索结果(标题和链接)的正则表达式。 正则表达式 --------------------编程问答-------------------- --------------------编程问答-------------------- 可以用Html Agility Packhttp://www.cnblogs.com/ITmuse/archive/2010/05/29/1747199.html --------------------编程问答-------------------- --------------------编程问答--------------------
--------------------编程问答-------------------- 没仔细看这些a标签是不是格式一致,不一致的话不适合用正则,应该用一些html解析工具来完成
string html = @"<a
data-click=""{
'F':'778317EA',
'F1':'9D73F1E4',
'F2':'CCA6DE6B',
'F3':'54E5243F',
'T':'1377393932',
'y':'ECFDBFED'
}""
href=""http://www.baidu.com/link?url=u9tViJ36qpg0qrIozCI91cKv5Xc_Z6z2riTKCSAFedW0B1gzY6DthIXPdq2jL-kG""
target=""_blank""
><em>Entity</em> <em>Framework</em> - Home</a></h3><div class=""c-abstract"">This site is dedicated to working with and contributing to the <em>Entity</em> <em>Framework</em> code base. If you want to use an officially supported <em>Entity</em> <em>Framework</em> ...</div><div class=""f13""><span class=""g""><b>entityframework</b>.codeplex.com/ 2013-8-16 </span>- <a data-nolog href=""http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed4fece76310418b204212cb377c848f423a89d31184642c101a30b4f979755a13d3b22d3a5eb25d19b7b0607d605f66ecdd839f4aacefd27b70df62693045&p=cb3edf15d9c342af40a9c7710f4e96&newp=9f7e865dc8934eaf5bedc32d02149e231610db2151d1d71128&user=baidu&fm=sc&query=entity+framework&qid=&p1=1""
target=""_blank""
class=""m"">百度快照</a><span data-nolog class=""liketip"" id=""like_8391980276214201956""></span></div></td></tr></table><table class=""result"" id=""2"" srcid="""" tpl=""se_st_default"" ><tr><td class=""f"" ><h3 class=""t""><a
data-click=""{
'F':'778317EA',
'F1':'9D73F1E4',
'F2':'6CA6DD6B',
'F3':'54E5B43F',
'T':'1377393932',
'y':'DFF9AFF3'
,'rsv_sug9':'entity framework 教程'
}""
href=""http://www.baidu.com/link?url=Rb8jJuMgg7aIWm3rxB9BWeO2mgB6-YDUi5hCHB0N_n3fjesObC0hMmaLKOl0dBzq""
target=""_blank""
><em>Entity</em> <em>Framework</em> 专题 - 博客园知识库</a></h3><div class=""c-abstract""><em>Entity</em> <em>Framework</em>的全称是ADO.NET <em>Entity</em> <em>Framework</em>,是微软开发的基于ADO.NET的ORM(Object/Relational Mapping)框架。";
foreach (var queryresult in Regex.Matches(html, @"(?is)<a[^>]*?data-click=""[^""]*?""[^>]*?href=""(?<url>[^""]*?)""[^>]*?>\s*<em>(?<title1>.*?)</em>\s*<em>(?<title2>.*?)</em>(?<title3>.*?)</a>").OfType<Match>().Select(x => new { url = x.Groups["url"].Value, title = x.Groups["title1"].Value + x.Groups["title2"].Value + x.Groups["title3"].Value }))
{
Console.WriteLine("url:" + queryresult.url + "\t" + "title:" + queryresult.title);
}
补充:.NET技术 , C#