tryusing System.Text.RegularExpressions;string s = "................."; Regex re = new Regex(@"<img[^>]+src=(?:""(?<src>[^""]+)""|'(?<src>[^']+)'|(?<src>\S+))[^>]*>", RegexOptions.IgnoreCase);
MatchCollection mc = re.Matches(s);
Console.WriteLine(mc.Count);
foreach(Match m in mc)
Console.WriteLine("{0} --> {1}", m.Value, m.Groups["src"].Value);
MatchCollection mc = re.Matches(s);
Console.WriteLine(mc.Count);
foreach(Match m in mc)
Console.WriteLine("{0} --> {1}", m.Value, m.Groups["src"].Value);
<img\s*src\s*=\s*[""']?.+\s*.(gif|jpg|bmp|tif|png)\s*.+[^\w]
请问应该如何改?