这个东西是我找了老长时间然后拼凑起来的,希望大家能用上
public static string GetImgUrl(string content, int height, int width)
{
string ps = @"<img/s+[^>]*src/s*=/s*(?:""(?<url>[^""]*)""|'(?<url>[^']*)'|(?<url>[^>^/s]+)).*?>";
Regex reg = new Regex(ps, RegexOptions.IgnoreCase);
for (Match m = reg.Match(content); m.Success; m = m.NextMatch())
{
content = content.Replace(m.Groups[0].ToString(), "<img src=/"" + m.Groups["url"].ToString() + "/" border=/"0/" οnlοad=/"changeImg(this," + height + "," + width + ")/">");
}
return content;
}