[thelist] FWD: RE: Function to strip HTML in ASP

Daniel J. Cody dcody at oracular.com
Tue Jul 11 14:03:12 CDT 2000


From: Madhu Menon <madhu_news at postmark.net>
To: thelist at lists.evolt.org
Reply-To: madhu at asiacontent.com
Subject: RE: Function to strip HTML in ASP
Date: Tue, 11 Jul 2000 18:34:26 +0530
Content-Type: text/plain; charset="iso-8859-1"

Adrian wrote:

>have you tried Server.HTMLEncode(strWebPage)  ? 
>or even do a replace on < and >... 

I'm aware of this function of course and use it routinely to prevent
someone trying to get malicious code to execute in message boards and
the like.

But this is not what I want to do.

I want a way to take the following text:

<i>John Doe</i>, President, said <b> blah blah blah important stuff
</b>

and turn it into:

John Doe, President, said blah blah blah important stuff 

I.e, get rid of all the HTML formatting. A possible use of something
like this would be in getting a "printable version" of an article. For
example, if you used it on Evolt, you could strip out the HTML and
send just the text in the "Email story to friend" feature, instead of
all the tags that get sent along with the message as plain text at the
moment.

>version of IIS/ASP you got running?  older versions lack simple 
>regular expressions, so a 

I'm running IIS 4.0 with VBScript 5.0 on NT 4.0, although if there's
something in ASP 3.0 that can make this simple, shoot. I'll upgrade :)
(actually, I have another server with Win 2K too)

Now, the RegExp object can handle simple regular expressions, it
tells you the position of the match. Does it tell you the length of
the substring too? If it did, I could use a Replace function to
replace it with a blank.

Thanks,

Madhu

<<<   *   >>>
Madhu Menon
Webmaster, CNET India
http://India.CNET.com
The source for computers and technology




More information about the thelist mailing list