Replace value of QueryString parameter

Hello,

I would like to replace the value of a querystring parameter with javascript. Something like:

URL: http://localhost/Europe.asp?group=Europe&region=Italy&pview=25&page=1

I want to change the value of pview. I think I just need some Regular Expression to match the pview=? (any number)

var qs = new String(window.location);
alert(qs.replace(someregexp,'pview='+newval));

Thanks,
vc


var reExp = /pview=\\d+/;
var url = window.location.toString();
var newUrl = url.replace(reExp, "pview=" + newValue);

Worked perfectly. Thank you.

Regular expressions drive me nuts.

Yes, they can drive u nuts, but they are extremely powerful.