Removes the HTML. - CSharp System.Web

CSharp examples for System.Web:Web Page

Description

Removes the HTML.

Demo Code


using System.Net;
using System.IO;//from  w w  w.  j  a v a 2  s .c  o  m
using System.Text.RegularExpressions;
using System.Web;
using System.Text;
using System.Collections.Generic;
using System;

public class Main{

        public static string RemoveHtml(string html)
        {
            html = Regex.Replace(html, "<br>", " ");
            html = Regex.Replace(html, @"<[\s|\S]+?>", string.Empty);
            html = Regex.Replace(html, "&nbsp;", " ");
            html = Regex.Replace(html, " {2,}", " ");
            html = Regex.Replace(html, @"\s", "");
            return html;
        }
}

Related Tutorials