Solved

RegExp Replace object on TextStream not working

Posted on 2001-08-24
2
246 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

752 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