如题,想实现一个过滤HTML的标记,看到有人发帖用到了ConvertGettext这个函数,可是他不在System.Text.RegularExpression下啊,我现在使用的是vs2008,在System.Web.RegularExpression名字空间下也没有。

解决方案 »

  1.   

    protected static string ConvertGettext(string str)
        {
            Regex regex = new Regex(@"(?i)<(?!p|br|img).*?>", RegexOptions.IgnoreCase);        return regex.Replace(str, "").Replace("&nbsp;", "").Replace("\n", "").Replace("\r", "");
        }这是人家自己写的方法
      

  2.   

    不好意思,我是看到这个方法了,但是没有看到他在那里引用这个放法,他写在这里了Console.WriteLine(ConvertGettext(str)),没有留心 看。所以,以为是api那。谢谢您的帮助,结贴。