public string FCKPic(string fckvalue)
    {
        string fckStr = "";
        MatchCollection matchs = Regex.Matches(fckvalue, @"<img\s[^>]*src=([""']*)(?<src>[^'""]*)\1[^>]*>", RegexOptions.IgnoreCase);
        if (matchs.Count > 0)
        {
            Match m = matchs[0];
            int i;
            if (m.Groups["src"].Value != "")
            {
                    fckStr = m.Groups["src"].Value;
            }
            else
            {
                fckStr = "";
            }
        }
        else
        {
            fckStr = "";
        }
        return fckStr;
    } 上面是一个在FCK编辑器的内容中取得图片的方法  可是只能取一张啊  我想不管有多少都可以取得到   听说把matchs.Count用循环可以做到 不知道怎么写啊?希望那位高手帮帮忙啊!分数不够还可以再加啊!

解决方案 »

  1.   

     服了你了 用之前改下public string FCKPic(string fckvalue) 
        { 
            string fckStr = ""; 
            MatchCollection matchs = Regex.Matches(fckvalue, @" <img\s[^>]*src=([""']*)(? <src>[^'""]*)\1[^>]*>", RegexOptions.IgnoreCase); 
            if (matchs.Count > 0) 
            { 
                 foreach   (Match   m   in   matchs)   { 
                            Response.Write(m.Groups[ "src "].Value+ " <br> "); 
                    } 
            } 
            else 
            { 
                fckStr = ""; 
            } 
            return fckStr; 
        } 
      

  2.   

       public string FCKPic(string fckvalue)
        {
            string fckStr = "";
            MatchCollection matchs = Regex.Matches(fckvalue, @"<img\s[^>]*src=([""']*)(?<src>[^'""]*)\1[^>]*>", RegexOptions.IgnoreCase);
            if (matchs.Count > 0)
            {            foreach (Match m in matchs)
                {
                    fckStr = m.Groups["src "].Value + " <br> ";
                }         }
            else
            {
                fckStr = "";
            }
            return fckStr;
        } 对同意2楼的啊