以下为谷歌搜索结果,搜索出来页面有十个,这是其中之一。
想请教:
1、获取十个MatchCollection,用正则表达式如何获取 下面这个 信息?
2、获取后,想获取 标题 <b>什么</b>是&gt;&gt; 首页-<b>什么</b>是<b>什么</b>,搜搜就知道!
网址 <cite>www.shenmeshi.com/</cite> 里面内容如何写出正则表达式?用C#如何写》在线等待!<li class=\"g\"><h3 class=\"r\"><a href=\"/url?q=http://www.shenmeshi.com/&sa=U&ei=P047T9T6Ge-5iAfg0MyHCg&ved=0CBoQFjAA&usg=AFQjCNH_p8jXiBEWFJqkqU8bYzKJkIIYpg\" target=\"_blank\"><b>什么</b>是&gt;&gt; 首页-<b>什么</b>是<b>什么</b>,搜搜就知道!</a></h3><div class=\"s\">最新文章; <b>什么</b>是财政拖累 &middot; <b>什么</b>是专款支出 &middot; <b>什么</b>是基金份额持有人 &middot; <b>什么</b>是基金<br>  清盘 &middot; <b>什么</b>是反转型态 &middot; 教育学习 &middot; 管理 &middot; 营销 &middot; 物流 &middot; 教育 &middot; 资格认证 &middot; 会计 &middot; 认证 <b>...</b><br><div><cite>www.shenmeshi.com/</cite><span class=\"flc\"> - <a href=\"//webcache.googleusercontent.com/search?hl=zh-CN&q=cache:Ulz2ynZAhAoJ:http://www.shenmeshi.com/+%E4%BB%80%E4%B9%88&ct=clnk\" target=\"_blank\">网页快照</a> - <a href=\"/search?hl=zh-CN&tbo=1&q=related:http://www.shenmeshi.com/+%E4%BB%80%E4%B9%88&sa=X\">类似结果</a></span></div></div></li>

解决方案 »

  1.   

    string tempStr = File.ReadAllText(@"C:\Documents and Settings\Administrator\桌面\Test.txt", Encoding.GetEncoding("GB2312"));
                    string pattern = @"(?<=<h3[\s\S]*?)(<b>[\s\S]*?</b>[^<]*)+";
                    string title = Regex.Match(tempStr, pattern).Value;//<b>什么</b>是&gt;&gt; 首页-<b>什么</b>是<b>什么</b>,搜搜就知道!
                    string href = Regex.Match(tempStr, @"(?<=<cite>\s*)[^<]+").Value;//www.shenmeshi.com/
      

  2.   

     string tempStr = File.ReadAllText(@"C:\Documents and Settings\Administrator\桌面\Test.txt", Encoding.GetEncoding("GB2312"));
                    string pattern = @"(?<=<h3[\s\S]*?)((<b>[\s\S]*?</b>[^<]*)+)[\s\S]*?(<cite>\s*([^<]+)\s*</cite>)";
                    foreach (Match m in Regex.Matches(tempStr, pattern))
                    {
                        //循环输出
                        string title = m.Groups[1].Value;//<b>什么</b>是&gt;&gt; 首页-<b>什么</b>是<b>什么</b>,搜搜就知道!
                        string href_all = m.Groups[3].Value;//<cite>www.shenmeshi.com/</cite>
                        string href = m.Groups[4].Value;//www.shenmeshi.com/
                    }
      

  3.   


    您好,在谷歌搜索时,其中有一个结果还是没有提取出来搜索关键字为:什么
    无法提取的代码:<li class=\"g\"><h3 class=\"r\"><a href=\"/url?q=http://www.syebh.com/yanhouzhuanke/biantaotiyan/bingli/biantaotifayanxiyaozhiliao-biantaotifayangaoshaochishenmexiaoyanyaoxiaoguozuihao.html&sa=U&ei=P047T9T6Ge-5iAfg0MyHCg&ved=0CDgQFjAI&usg=AFQjCNGrLOs9MI3M3fmLRK5AVkGgxzfz5w\" target=\"_blank\">扁桃体发炎西药治疗:扁桃体发炎高烧吃<b>什么</b>消炎药效果最好- 耳鼻喉 <b>...</b></a></h3><div class=\"s\">扁桃体发炎西药治疗:扁桃体发炎高烧吃<b>什么</b>消炎药效果最好患者性别:女患者年龄: <br>  40 全部症状:咽下痛而耳塞,没有温度发病时间及原因: 一星期治疗情况:现在吃 <b>...</b><br><div><cite>www.syebh.com/.../biantaotifayanxiyaozhiliao- biantaotifayangaoshaochishenmexiaoyanyaoxiaoguozuihao.html</cite><span class=\"flc\"> - <a href=\"//webcache.googleusercontent.com/search?hl=zh-CN&q=cache:3aODCGoEC6QJ:http://www.syebh.com/yanhouzhuanke/biantaotiyan/bingli/biantaotifayanxiyaozhiliao-biantaotifayangaoshaochishenmexiaoyanyaoxiaoguozuihao.html+%E4%BB%80%E4%B9%88&ct=clnk\" target=\"_blank\">网页快照</a> - <a href=\"/search?hl=zh-CN&tbo=1&q=related:http://www.syebh.com/yanhouzhuanke/biantaotiyan/bingli/biantaotifayanxiyaozhiliao-biantaotifayangaoshaochishenmexiaoyanyaoxiaoguozuihao.html+%E4%BB%80%E4%B9%88&sa=X\">类似结果</a></span></div></div></li>
      

  4.   


    提取的结果,都是以 什么 开头,前面的文字都丢了
    例如:关于什么的作文_百分网 提取的结果是 什么的作文_百分网
    太麻烦您了什么是>> 首页-什么是什么,搜搜就知道!
    www.shenmeshi.com/
    什么_百度百科
    baike.baidu.com/view/2474.htm
    什么的作文_百分网
    www.oh100.com/zuowen/shenme/
    什么最赚钱?
    www.iwms.net1388c38.aspx
    什么是爱情? - 有意思吧
    www.u148.net/.../1753.ht...
    什么网
    www.webjb.org/
    什么值得买|高性价比网购产品推荐。网上购物,网购,海淘,海外购,特价 ...
    www.smzdm.com/
    什么是什么意思_翻译_爱词霸在线词典
      

  5.   

    是可以提取出来的 
     string tempStr = File.ReadAllText(@"C:\Documents and Settings\Administrator\桌面\Test.txt", Encoding.GetEncoding("GB2312"));
                    string pattern = @"(?<=<h3[\s\S]*?)((<b>[\s\S]*?</b>[^<]*)+)[\s\S]*?(<cite>\s*([^<]+)\s*</cite>)";
               
                    foreach (Match m in Regex.Matches(tempStr, pattern))
                    {
                        //循环输出
                        string title = m.Groups[1].Value;//<b>什么</b>消炎药效果最好- 耳鼻喉 <b>...</b>
                        string href_all = m.Groups[3].Value;//<cite>www.syebh.com/.../biantaotifayanxiyaozhiliao- biantaotifayangaoshaochishenmexiaoyanyaoxiaoguozuihao.html</cite>
                        string href = m.Groups[4].Value;//www.syebh.com/.../biantaotifayanxiyaozhiliao- biantaotifayangaoshaochishenmexiaoyanyaoxiaoguozuihao.html
                    }