ASP.NET 过滤html中的图片与换行

 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, "");
        System.Text.RegularExpressions.Regex regex1 = new System.Text.RegularExpressions.Regex("<(.|\n)+?>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
        html = regex1.Replace(html, "");
        return html;
    }
posted @ 2010-06-23 23:46  你妹的sb  阅读(343)  评论(0编辑  收藏  举报
百度一下