[thelist] Anal String Replace (ASP)
Jason Handby
jasonh at corestar.co.uk
Thu Oct 14 16:43:57 CDT 2004
> Of course if you can do RegExps in your version of
> VBScript, that might be the better option, but that's not my
> area of expertise.
The regexp you need is below. It basically says, replace each dot with an
underscore provided that it's followed by another dot further down the
string.
<%
s = "this.is.a.test.htm"
Response.Write s & "<br>"
set r = new RegExp
r.Global = true
r.Pattern = "\.(?=.*\.)"
s = r.Replace(s, "_")
Response.Write s
set r = nothing
%>
I know Rob doesn't need it any more, but I'm so happy that I just worked it
out! :-)
Jason
More information about the thelist
mailing list