首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

c#怎么获取该网页的内容

2012-12-26 
c#如何获取该网页的内容如上图,我想获取选中部分的data-follow内的值,正则我已经写出来了,就是只能获取第

c#如何获取该网页的内容
c#怎么获取该网页的内容
如上图,我想获取选中部分的data-follow内的值,正则我已经写出来了,就是只能获取第一个,以下的都获取不到代码是这样的


Regex r = new Regex(@"(?is)data-follow=""([^""]+)""");
             foreach (HtmlElement he in myWeibo.Document.GetElementsByTagName("li"))
             {
                 //Regex reg = new Regex(@"(?is)title=""([^""]+)"" href=""([^""]+)""");

                 if (he.GetAttribute("classname") == "clearfix")
                 {
                     Match mm = r.Match(he.InnerHtml);
                     MessageBox.Show(mm.Groups[1].Value);
                 }
             }

求高手解答,我想获取uid=后面的数字,和fnick=后面的名字,谢谢高手啦,在线等,急急急
[解决办法]
Regex regex = new Regex("(?<=data-follow=").*?(?=")");
MatchCollection mc = regex.Matches(myWeibo.Document.Body.InnerHtml);
            foreach (Match item in mc)
            {
                //item.Value
            }

热点排行