removeing html from a text string

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!
 
T

Tim Stephenson

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;"), "'", "''")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top