Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

RegExp Replace object on TextStream not working

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
RichBisset
Asked:
RichBisset
1 Solution
 
AlfaNoMoreCommented:
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
 
RichBissetAuthor Commented:
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

Industry Leaders: 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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now