62,242
社区成员




public static IList<string> GetPicPath(string M_Content)
{
IList<string> im = new List<string>();//定义一个泛型字符类
Regex reg = new Regex(@"<img.*?src=""(?<src>[^""]*)""[^>]*>", RegexOptions.IgnoreCase);
MatchCollection mc = reg.Matches(M_Content); //设定要查找的字符串
foreach(Match m in mc)
{
im.Add(m.Groups["src"].Value);
}
return im;
}
Regex reg = new Regex(@"(?i)<img[^>]*?\ssrc\s*=\s*(['""]?)(?<src>[^'""\s>]+)\1[^>]*>");
MatchCollection mc = reg.Matches(yourStr);
foreach (Match m in mc)
{
Console.Write(m.Groups["src"].Value + "\n");
}