如何用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