Skip to content

Instantly share code, notes, and snippets.

@juanpablocs
Last active August 29, 2015 14:25
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 juanpablocs/2494a52714c551c80975 to your computer and use it in GitHub Desktop.
Save juanpablocs/2494a52714c551c80975 to your computer and use it in GitHub Desktop.
get name repository from url github
//get name github url from javascript
var repo_url = "http://github.com/frontend-labs/flux"; //obtain => flux
var name = repo_url.replace(/http(?:s|)\:\/\/(?:www\.|)github\.com\/(?:.*?)\/(.*?)/, "$1")
console.log(name); // flux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment