So, I want to replace the values ββof the GET variable in url, and if the variable does not exist, add it to url.
EDIT: I do this with href elements, not the current location of the pages.
I am not good at javascript, but I know how to use jQuery and the basics of javascript correctly. I know how to write a regular expression, but not how to use the regular expression javascript syntax and what functions to use it.
Here is what I have so far and it has an error on line 3: Look at jsfiddle (or below): http://jsfiddle.net/MadLittleMods/C93mD/
function addParameter(url, param, value) {
var pattern = new RegExp(param + '=(.*?);', 'gi');
return url.replace(pattern, param + '=' + value + ';');
alert(url);
}