Remove HTML from string with regular expression

It's really simple to do that with just a few lines of code.  Here is how to:

Private Function RemoveHTML(ByVal str As String) As String

Dim RegExp As String = "<[^>]*>"

Dim R As New Regex(RegExp) Return R.Replace(str, " ")

End Function

And you can get the "clear" string for your label control (for example):

Label1.Text = RemoveHTML(TextBox1.Text)

Cheers

No Comments