Remove HTML tags using Regular Expression in C#

Posted by Raja under C# category on | Points: 40 | Views : 1017
Here is a C# function that can be used to remove HTML tags from the content. It will ensure that returned content is pure text.

public static string RemoveHtml(string source)
return Regex.Replace(source, "<.*?>|&.*?;", string.Empty);

This also removes &nbsp; (blank space) from the content.


Comments or Responses

Login to post response