ASP.NETでHTMLタグを消す方法

2522 ワード

   ///     HTML      
    ///      
    ///      
    ///     HTML      
    ///              
    public static string GetNoHTMLString(string Htmlstring)
    {
        //       
        Htmlstring = Regex.Replace(Htmlstring, @"]*?>.*?", "", RegexOptions.IgnoreCase);
        //  HTML   
        Htmlstring = Regex.Replace(Htmlstring, @"]*)>", "", RegexOptions.IgnoreCase);
        Htmlstring = Regex.Replace(Htmlstring, @"([\r
])[\s]+", "", RegexOptions.IgnoreCase); Htmlstring = Regex.Replace(Htmlstring, @"-->", "", RegexOptions.IgnoreCase); Htmlstring = Regex.Replace(Htmlstring, @"