Once again I am blogging about the Regular expresisons at work.
Here is a link to my previous blog. I guess now I have become an addict to using Regular Expressions to make life easier and am now longer a newbie to them.
Today I just came accross the task of cleaning the users input string on one of my forms free from all the HTML tags. I decided to google this and found a really nice piece from code from Jóhann Gunnarsson.
Code in VB.NET
Dim RegExStr As String = “<[^>]*>”
Dim R As New Regex(RegExStr)
TempStr = R.Replace(TempStr, ” “)
Only three lines of code and your string is free from HTML tags, its a beauty.




This expression is not working all the time like
” id=”content”>Some Text
please note that using the mentioned regex you will get this
and this is not we want
this is another way to remove all your html tags from ur text
(]+>)