首页 > 开发 > .Net > 正文

asp.net 过滤图片标签的正则

2020-04-24 22:10:26
字体:
来源:转载
供稿:网友
代码如下:
public static string replaceImgUrl(string html)
{
if (html == null)
return "";

System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"/<img[^/>]+/>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
html = regex.Replace(html, ""); //过滤frameset
return html;
}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表