Solved

RegExp Replace object on TextStream not working

Posted on 2001-08-24
2
245 Views
Last Modified: 2008-03-06
I am using the textStream object to output the contents of an HTML file. As its outputting i want to search for html tags and replace them, however it would seem to match the > and < characters.

For instance if i search for "/b" and replace it with something else it works. Whereas if i try to replace "</b>" it doesnt work. Ive tried "&lt/b&gt" and still no joy.

What is the problem with the > and < characters? The textStream is set to ASCII format (tristate false).

Secondly, if i find an html tag, i want to stop the stream, response.write the equivalent code in HTML format and then continue streaming again, how could i do that?

thanks
0
Comment
Question by:RichBisset
2 Comments
 
LVL 9

Accepted Solution

by:
AlfaNoMore earned 75 total points
ID: 6421472
Ermmm, just use Server.HTMLencode! It will convert all <'s and >'s to &lt; and &gt;, thus preventing the tags being parsed by the browser.

objTS = objFSO.openAsTextStream(filename)

Response.write Server.HTMLencode(objTS).

Easy?
0
 

Author Comment

by:RichBisset
ID: 6421581
Thanks,

The problem was i was using Sever.HTMLencode in the first place!! that will teach me for copying code from a book without thinking what its doing.

0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question