RegExp, match, replace
by webproger on 2020-02-09
function sv(v) {
  var r = new RegExp("&s=[0-9]+");
  if(window.location.href.match(r))
       window.location.href = window.location.href.replace(r,"&s="+v);
  else window.location.href = window.location.href+"&s="+v;
}

var ur = document.getElementById('ur').value;
var re = new RegExp("https:\/\/www\.bing\.com\/maps\\?");
ur = ur.replace(re,encodeURIComponent(document.getElementById('tl').value)+"&");