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

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
            }