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

Published Tuesday, May 26, 2009 7:37 AM by stoian bucovich

Comments

# Stoian bucovich | Alliterationpl

Saturday, November 26, 2011 3:50 PM by Stoian bucovich | Alliterationpl

Pingback from  Stoian bucovich | Alliterationpl

Leave a Comment

(required) 
(required) 
(optional)
(required)