To strip html tags from string in C# and VB.NET you can use the following snippet.

Sample C#

public string StripHtmlTags (string input)
{
	string pattern = "<.*?>";
	return Regex.Replace (input, pattern, string.Empty);
}

Sample VB.NET

Public Function StripHtmlTags(input As String) As String
	Dim pattern As String = "<.*?>"
	Return Regex.Replace(input, pattern, String.Empty)
End Function

One thought on “How to strip html tags from string in C# and VB.NET”

Leave a Reply