<a href="/Portals/0/201111510304674.jpg"><img alt="" style="width: 167px; height: 242px" src="http://127.0.0.1/Portals/0/BatchImages/2013/0514/635041461750963374.jpg" /></a>如上html
分别截取出href的值
 /Portals/0/201111510304674.jpg和 src的值
http://127.0.0.1/Portals/0/BatchImages/2013/0514/635041461750963374.jpg谢谢啦

解决方案 »

  1.   


     string html = @"<a href=""/Portals/0/201111510304674.jpg""><img alt="""" style=""width: 167px; height: 242px"" src=""http://127.0.0.1/Portals/0/BatchImages/2013/0514/635041461750963374.jpg"" /></a>";
                string htmlpattern = @"(?is)<a[^>]*?href=""(?<href>[^""]*?)""[^>]*?>\s*<img[^>]*?src=""(?<src>[^""]*?)""[^>]*?/>\s*</a>";
                Console.WriteLine(Regex.Match(html, htmlpattern).Groups["href"].Value);
                Console.WriteLine(Regex.Match(html, htmlpattern).Groups["src"].Value);
      

  2.   

    用正则应该比较简单,或者构建成一段xml,通过简单的解析直接去取标签的属性
      

  3.   

    Regex regex = new Regex("<a.*?href=\"(?<href>.*?)\".*?src=\"(?<src>.*?)\".*?>", RegexOptions.Compiled);