匹配img标签路径的正则表达式为:(?i)(?<=<img\b[^>]*?src=\s*(['""]?))([^'""]*/)+(?=[^'""/]+\1)
string url = string.Empty;
string turl=""//替换的路径
MatchCollection match = res.Matches(str);//str为你要匹配的html代码
if (res.IsMatch(str))
{
foreach (var item in match)
{
url = Regex.Replace(str, @"(?i)(?<=<img\b[^>]*?src=\s*(['""]?))([^'""]*/)+(?=[^'""/]+\1)", );
}
}