Skip to content

Instantly share code, notes, and snippets.

@ashimon83
Created May 28, 2021 09:24
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 ashimon83/1f8edabb80a5099aba1b67e32584711c to your computer and use it in GitHub Desktop.
Save ashimon83/1f8edabb80a5099aba1b67e32584711c to your computer and use it in GitHub Desktop.
get url param from slashed url
// /path1/123/path2/345
location.pathname.match(/\/path1\/([^\/]+)/)
// /path1/123
location.pathname.match(/\/path2\/([^\/]+)/)
// /path2/345
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment