RegularExpression remove html tags

RegularExpression remove html tags
Remove all html tags from html contents using regular expression. Here are and example to remove all html tags from given content. C# remove all html tags from given html contents.
public string ParserHtml(string html)
return System.Text.RegularExpressions.Regex.Replace(html, @"<[^>]*>", "").Trim();
} function to remove all HTML tags from html content.
Public Function ParserHtml(html As String) As String
Return System.Text.RegularExpressions.Regex.Replace(html, "<[^>]*>", "").Trim()
End Function

How to use above functions? You just need to pass the html content to the above function and get the plain text output.

To learn REgular expressions, I recommand you to follow below links and install the software.

You may want to remove html tags from response recived by HttpWebResponse object, there you can use above expression.

You can learn regualr expression using below tool

html without using tables tableless html table less html css tableless layoutsBasic HTML5 TagsHow to remove Security TagsRemove internet explorerC# HtmlTextWriter How to display HTML contentsOnline html editor online JavaScript HTML5 Generate Article TagJQuery add/remove Class DynamicallyHTML5 Create Html Controls


My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.

I'm Satalaj.