Removing All HTML Tags from a String

Remove all HTML tags from your code. I have just noticed that I had a problem with this site in that the short preview shown on the homepage contain parts of HTML that was within the main body of the post, and this caused some of the site to break. Once I had spotted the oversite I decided to fix it with a simple Regular Expression. Here is the code in VB.NET Dim strRegEx As String = '<[^>]*>' Dim myRegex As New Regex(strRegEx) strStringToRemoveHTMLFrom = myRegEx.Replace(strStringToRemoveHTMLFrom, ' ') Three lines of code and the problem has disappeared.

Details:
Admin
01.01.2012 20:15:32
Tags:
regex code vb html