Discussion:
Replace URL parameters
Jakub
2010-02-10 11:48:36 UTC
Permalink
Hello there!
I have function:

function Dummy(){
adress = window.location.href;
regex = "/^&(.*?)?$/";
adress = adress.replace(regex,'');
alert(adress);
}

I want to replace all parameters, but first. I don't know what is
wrong .. :-(
Nathan Klatt
2010-02-10 15:03:02 UTC
Permalink
Post by Jakub
I want to replace all parameters, but first. I don't know what is
wrong .. :-(
Could you give an example of what you want to happen? I.e., an input
string and what you want it to look like after the replace?

Nathan
Nathan Klatt
2010-02-10 15:03:44 UTC
Permalink
   function Dummy(){
     adress = window.location.href;
     regex = "/^&(.*?)?$/";
     adress = adress.replace(regex,'');
     alert(adress);
   }
One problem is you don't want to put quotes around the regex.

Nathan

Loading...