Solved

RegExp Replace object on TextStream not working

Posted on 2001-08-24
2
238 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now