Skip to content

Instantly share code, notes, and snippets.

@gargomoma
Created February 27, 2023 10:08
Show Gist options
  • Save gargomoma/2cb36d7a9462340e949d41b55235bfb1 to your computer and use it in GitHub Desktop.
Save gargomoma/2cb36d7a9462340e949d41b55235bfb1 to your computer and use it in GitHub Desktop.
exctrac parameters from url
function extractParam(url,param){
var regex = new RegExp(`(?<=${param}=)[^&]+`);
var match = url.match(regex);
if (match) {
const result = match[0];
return result
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment