Skip to content

Instantly share code, notes, and snippets.

@cvan
Created July 7, 2020 02:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cvan/5554c7a3d7895e192e65f39bb9ecc7fc to your computer and use it in GitHub Desktop.
Save cvan/5554c7a3d7895e192e65f39bb9ecc7fc to your computer and use it in GitHub Desktop.
JS regex one-liner for query-string value parsing
// Just replace `placeholder_name` with the actual key for which you want its value.
var placeholderName = decodeURIComponent((window.location.search.match(/[?&]placeholder_name=([^&]+)/)||['', ''])[1]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment