解决方案 »

  1.   

    (?i)<img[^>]*?src=(['""]?)(?<src>[^'""]*?)\1[^>]*?>.Group["src"]
      

  2.   

      Regex regex = new Regex("(?i)<img[^>]*?src=(['\"\"]?)(?<src>[^'\"\"]*?)\\1[^>]*?>", RegexOptions.IgnoreCase);
                var a = regex.Match(str);
                for (int i = 0; i < a.Groups.Count; i++)
                {
                    var b  = a.Groups[i].Value;
                }为啥我获取到的是三个 img 第一个是对的,第二个是"/" 第三个跟第一个数据一样,
    而不是我对应的分别三个img ,这是什么问题?能帮忙看看吗  
      

  3.   

                Regex regex = new Regex(@"(?i)<img.*?src=(['""]?)(?<src>[^'""]*?)\1[^>]*?>", RegexOptions.IgnoreCase);
                MatchCollection mc = regex.Matches(str);
                foreach(Match m in mc)
                {
                    Console.WriteLine(m.Groups["src"].Value);
                }