removeing html from a text string

  • Thread starter Thread starter Brian Henry
  • Start date Start date
B

Brian Henry

I want a way to remove all the html tags from a string... i have a ton of
html saved in an sql server and its indexed so i can do searches, but when i
return the text i get all the tags back (did server.encode when saveing to
the sql server) how can i remove the tags so i go from "<b>text</b>" to
"text" thanks!
 
The quickest way to do this would be to use regular expressions to search
and replace the html tags in your text.
Replace(Replace(Replace(Regex.Replace(yourTextString, "<(.|\n)+?>", " "),
"<", "&lt;"), ">", "&gt;"), "'", "''")
 
Back
Top