vcherubini
Programmer
Hello, been a while since I've been here.
Here's my question: I am writing a template class and I want to use Perl regular expressions. This is easy. However, I can't get the replace function to work.
For example, in Perl, all you have to do is:
[tt]
$_ =~ s/blah/replace/;
[/tt]
Which replaces blah with the word replace. How can I do this in ASP? This is the code I have which doesn't work:
[tt]
<%
set myreg = new RegExp
myreg.global = true
myreg.ignorecase = true
myreg.pattern = "/{{{[^>]+}}}/value/"
set fs = CreateObject("scripting.filesystemobject"
set wfile = fs.opentextfile("E:\location\of\template\template.tpl"
filecontent = wfile.readall
wfile.close
set wfile=nothing
set fs=nothing
set g_matches = myreg.execute(filecontent)
response.write(filecontent)
%>
[/tt]
Does ASP not support the ability to do this? If not, how can I get around this flaw? Basically, I want to replace everything in three braces ({{{blah}}}) with a value set in an array. Are regular expressions the best way to do this?
Thanks for the help,
-Vic vic cherubini
krs-one@cnunited.com
Here's my question: I am writing a template class and I want to use Perl regular expressions. This is easy. However, I can't get the replace function to work.
For example, in Perl, all you have to do is:
[tt]
$_ =~ s/blah/replace/;
[/tt]
Which replaces blah with the word replace. How can I do this in ASP? This is the code I have which doesn't work:
[tt]
<%
set myreg = new RegExp
myreg.global = true
myreg.ignorecase = true
myreg.pattern = "/{{{[^>]+}}}/value/"
set fs = CreateObject("scripting.filesystemobject"
set wfile = fs.opentextfile("E:\location\of\template\template.tpl"
filecontent = wfile.readall
wfile.close
set wfile=nothing
set fs=nothing
set g_matches = myreg.execute(filecontent)
response.write(filecontent)
%>
[/tt]
Does ASP not support the ability to do this? If not, how can I get around this flaw? Basically, I want to replace everything in three braces ({{{blah}}}) with a value set in an array. Are regular expressions the best way to do this?
Thanks for the help,
-Vic vic cherubini
krs-one@cnunited.com