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
Below sample code works for me for a single parameter and current URL but can be modified as per requirement.
function extract( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
just use it as shown below,
var result= extract("your parameter name");