I\'d like to extract from the url of a Google search the keyword of the search (e.g. for the keyword \"car\" : http://www.google.com/webhp?hl=en#sclient=psy&hl=en&si
function getParameterByName(name,url) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^]*)"),
results = regex.exec(url);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
alert(getParameterByName('q','https://www.google.com/search?q=buy+a+pc&oq=buy+a+pc&aqs=chrome..69i57j5j0l2j69i61.1674j0&sourceid=chrome&ie=UTF-8#psj=1&q=buy+a+pc'));