473,511 Members | 14,846 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HTML stripping?

Any one aware of a good library/function out there which quickly and
reliably can strip out all HTML from a string? We have an ASP.Net page that
needs to be able to scrub out some (rather bad) HTML from a CSV field, most
solutions we've come up with/found only partially work (some times missing
text or throwing out exceptions). I have to say this is the one and only
thing I miss from my PHP days $string = striphtml( $string );

Carlo

Jul 10 '07 #1
1 1236
On Jul 10, 11:29 pm, "Carlo Razzeto" <crazz...@hotmail.comwrote:
Any one aware of a good library/function out there which quickly and
reliably can strip out all HTML from a string? We have an ASP.Net page that
needs to be able to scrub out some (rather bad) HTML from a CSV field, most
solutions we've come up with/found only partially work (some times missing
text or throwing out exceptions). I have to say this is the one and only
thing I miss from my PHP days $string = striphtml( $string );
Carlo, you can try to use Regex.Replace, for example

string striphtml(string s) {
return Regex.Replace(s, @"<[^>]*>", "");
}

Jul 10 '07 #2

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

Similar topics

3
1718
by: Steveo | last post by:
I am currently stripping HTML from a string with the following code. (I know it's not the best way to strip HTML but bear with me) re.compile("<.*?>") I wanted to allow all H1 and H2 tags so i...
2
2282
by: Patrick | last post by:
Hello, after learning that I was taking a class in VB.NET, I have been drafted to solve all my companies VB/scripting problems - hey, I should know everything; I've already taken 6 classes ;) I...
22
5668
by: Trevor Orton | last post by:
Hello, I'm having a slight problem using the W3C html validator and I've reviewed the FAQ's with no luck so hopefully someone here would be kind enough to point me in the right direction. I...
22
11917
by: Martin Trautmann | last post by:
Hi all, is there any kind of 'hiconv' or other (unix-like) conversion tool that would convert UTF-8 to HTML (ISO-Latin-1 and Unicode)? The database output is UTF-8 or UTF-16 only - Thus almost...
258
8367
by: Terry Andersen | last post by:
If I have: struct one_{ unsigned int one_1; unsigned short one_2; unsigned short one_3; }; struct two_{ unsigned int two_1;
5
2437
by: David Sawyer | last post by:
I am trying to read in an HTML file and strip out the HTML code so that all I have left is the text of the body. Does anyone have any suggestions for doing this? Any HTML stripping routines or...
4
4146
by: Spondishy | last post by:
Hi, I'm looking for help with a regular expression and c#. I want to remove all tags from a piece of html except the following. <a> <b> <h1> <h2>
6
10167
by: Tina I | last post by:
Hi everyone, I have a small, probably trivial even, problem. I have the following HTML: I need to make this into a dictionary like this: dictionary = {"METAR:" : "ENBR 270920Z 00000KT 9999...
11
19839
by: Ciaran | last post by:
HI I know about ob_start( 'ob_gzhandler' ); But I'm looking for something that removes all line breaks and extra whitespace in the html before sending it to the visitor's browser. Is this...
3
1592
by: Michel Bouwmans | last post by:
Hey everyone, I'm trying to strip all script-blocks from a HTML-file using regex. I tried the following in Python: testfile = open('testfile') testhtml = testfile.read() regex =...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5676
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1583
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.