http://ent.qq.com/star/shouye2012/gangtai.htm
我只要要从这个网站上面获取这四块的所有内容,请大家帮忙正则表达式怎么写呀???我只要正则表达式,,求帮助呀,用正则表达式怎么写呀???行业数据C#正则表达式

解决方案 »

  1.   

    <div[^>]*>[\s\S]*?src="(?<pic>[^"]*)"\s*alt="(?<title>[^"]*)">[\s\S]*?<span\s*class="date">(?<date>[^<]*)</span>[\s\S]*<div[^>]*>(?<all>[^<]*)<
      

  2.   

    更正一下<div[^>]*>[\s\S]*?src="(?<pic>[^"]*)"\s*alt="(?<title>[^"]*)">[\s\S]*?<span\s*class="date">(?<date>[^<]*)</span>[\s\S]*?<div[^>]*>(?<all>[^<]*)<
    加个去贪婪,免得多匹配
      

  3.   

    不行呀筛选不到呀?这是两个正则吗?
     Regex Content = new Regex(@"<div[^>]*>[\s\S]*?src="(?<pic>[^"]*)"\s*alt="(?<title>[^"]*)">[\s\S]*?<span\s*class="date">(?<date>[^<]*)</span>[\s\S]*?", RegexOptions.IgnoreCase | RegexOptions.Multiline);
                System.Text.RegularExpressions.MatchCollection ct = Content.Matches(htmlCode);
                int count = 0;
              
                foreach (Match m in ct)
                {
                    mode n = new mode();
                    if (ct[count].Groups["src"].Value!="")
                    {
                       richTextBox1.AppendText = Clear.GetKeyName(m.Groups["src"].Value+ "\r\n");
                    }
                }
    我代码是这样写的可是筛选不到呀
      

  4.   


                string tempStr="";//源文本
     
                string pattern = @"(?i)<div[^>]*>[\s\S]*?src="(?<pic>[^"]*)"\s*alt="(?<title>[^"]*)">[\s\S]*?<span\s*class="date">(?<date>[^<]*)</span>[\s\S]*?<div[^>]*>(?<all>[^<]*)<";          
     
                Match m = Regex.Match(tempStr,pattern);
                string value1 = m.Groups["pic"].Value;
                string value2 = m.Groups["title"].Value;
                string value3 = m.Groups["date"].Value;
                string value4 = m.Groups["all"].Value;
      

  5.   

    string pattern = @"(?i)<div[^>]*>[\s\S]*?src=""(?<pic>[^""]*)""\s*alt=""(?<title>[^""]*)"">[\s\S]*?<span\s*class=""date"">(?<date>[^<]*)</span>[\s\S]*?<div[^>]*>(?<all>[^<]*?)<";          
      

  6.   

    我要获取到这个网站http://ent.qq.com/star/shouye2012/gangtai.htm上面的所有页数的这四块内容,该怎么办呢怎么样筛选到总的页数啊???
      

  7.   

    我代码是这样写的 
    string pattern = @"(?i)<div[^>]*>[\s\S]*?src=""(?<pic>[^""]*)""\s*alt=""(?<title>[^""]*)"">[\s\S]*?<span\s*class=""date"">(?<date>[^<]*)</span>[\s\S]*?<div[^>]*>(?<all>[^<]*?)<"; 
                
              string htmlCode = richTextBox2.Text;
                Regex Content = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.Multiline);
                System.Text.RegularExpressions.MatchCollection ct = Content.Matches(htmlCode);
                foreach (Match m in ct)
                {
                    mode n = new mode();
                    richTextBox1.AppendText(Clear.GetKeyName(m.Groups["title"].Value + "\r\n"));
                }运行结果如图
    为什么第一条标题“组图:46岁周慧敏现身显气质 露黄牙显不雅”获取不到呢
      

  8.   

    怎么循环获取这个网站上面的http://ent.qq.com/star/shouye2012/gangtai.htm所有页的这四块内容啊???