引用:
using System.Text.RegularExpressions;
using System.Collections;
string imagePath = "";
string Content = txtContent.Value;
MatchCollection mc = Regex.Matches(Content, @"src=""(?<img>[^""]*?)""", RegexOptions.IgnoreCase | RegexOptions.Multiline);
foreach (Match m in mc)
{
imagePath = m.Groups["img"].Value.Trim();
if (imagePath.Length != 0) //存在图片
{
//进行相关的操作
}
}