I working on the Query String and used the other separator or demilitator. Now I interest for delete.
I read the question Delete parameter and I use the script's write of LukePH.
function removeParameter(url, parameter)
{
var urlparts= url.split('?');
if (urlparts.length>=2)
{
var urlBase=urlparts.shift(); //get first part, and remove from array
var queryString=urlparts.join("?"); //join it back up
var prefix = encodeURIComponent(parameter)+'=';
var pars = queryString.split(/[&;]/g);
for (var i= pars.length; i-->0;) //reverse iteration as may be destructive
if (pars[i].lastIndexOf(prefix, 0)!==-1) //idiom for string.startsWith
pars.splice(i, 1);
url = urlBase+'?'+pars.join('&');
}
return url;
}
The separator is:
Separator
javascript Mako
= %24+
& +%23+
In this script there is
var pars = queryString.split(/[&;]/g);
I want change the sentence for use split on the separator +%23+
var pars = queryString.split(/[+%23+;]/g);
This not function because contains too many values.
How to change the regex for locate to string?