Re: String.Replace Not Working

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Thanks
Sorry about the multi-post, but you have two groups named JScript.

"Anthony Jones" wrote:


"Brett" <Brett@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:52B36AE8-C0EC-4B91-83C4-890821DE1CA3@xxxxxxxxxxxxxxxx
Sorry, if you've seen this one before, but there are 2 JScript newsgroups.

I have a classic ASP page containing a javascript function that runs
string.replace commands, such as

string.replace(/\\x3C/g,""); // < character
(note I also tried one \ instead of 2 before the 3C)

The command doesn't error out, it just does nothing. I checked the string
with an Alert both before and after, but no change. I even tried a simple
replace a with b, but nothing. Again, no error, just no replacing.

I checked many internet sources and my code appears to be correct.

Any ideas?


s = s.replace(/a/g,"b");

replace does not mutate the object against which it is called. It generates
a new string which it returns.


--
Anthony Jones - MVP ASP/ASP.NET



.



Relevant Pages

  • Re: String.Replace Not Working
    ... I have a classic ASP page containing a javascript function that runs ... string.replace commands, such as ... a new string which it returns. ...
    (microsoft.public.scripting.jscript)
  • Re: User defined array
    ... Anthony Jones wrote on 11 okt 2006 in ... string in order to call a method against it. ... (Please change the x'es to dots in my emailaddress) ...
    (microsoft.public.scripting.jscript)