473,322 Members | 1,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

removeing html from a text string

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!
Nov 17 '05 #1
1 1415
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(yourTextStri ng, "<(.|\n)+?>", " "),
"<", "&lt;"), ">", "&gt;"), "'", "''")
--
Regards

Tim Stephenson MCSD.NET
Charted MCAD & MCSD.NET Early Achiever
"Brian Henry" <br******@adelphia.net> wrote in message
news:eT**************@TK2MSFTNGP12.phx.gbl...
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!

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: TinyTim | last post by:
I'm a newbie at ASP & HTML. It seems that when you use server side code and you're going to return a customized HTML form with several fields and labels, you have to do an extensive amount of...
0
by: Brian Henry | last post by:
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...
20
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
4
by: Brian Henry | last post by:
Say I have a text string like "0002323235-3434-3545" and I want to remove the leading zeros, would a regular expression work here? sorry I haven't worked with regex's that much and still need to...
3
by: jcrouse | last post by:
I have a text file that is about 5000 line long. Each line begins with a TAB. I'm trying to loop through the file a line at a time and remove the TAB but can't figure out how. I tried a substring...
2
by: David Virgil Hobbs | last post by:
Loading text strings containing HTML code into an HTML parser in a Javascript/Jscript I would like to know, how one would go about loading a text string containing HTML code, so as to be able to...
1
by: since | last post by:
I figured I would post my solution to the following. Resizable column tables. Search and replace values in a table. (IE only) Scrollable tables. Sortable tables. It is based on a lot...
2
by: anu b | last post by:
Now i am sending email to my friend using session variable... but my code is as below private bool SendEmail(string email) { try
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.