当前位置: 代码迷 >> ASP.NET >> 捕获图片(正则表达式),该怎么解决
  详细解决方案

捕获图片(正则表达式),该怎么解决

热度:8616   发布时间:2013-02-25 00:00:00.0
捕获图片(正则表达式)
如何用C#捕获一个页面中所有图片的src 值。

------解决方案--------------------------------------------------------
C# code
 string sPtn = @"<img[^>]+?src=([""'])([^\1]+?)\1[^>]*/?>";            Match mt = Regex.Match(sHtml, sPtn);            while (mt.Success)             {                                Console.WriteLine(mt.Groups[2].Value);                mt = mt.NextMatch();            }
------解决方案--------------------------------------------------------
加个RegexOptions.IgnoreCase