Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const pattern = /^(?:\S+:\/\/)?(?:\S+@)?(?'host'\S+?)[:\/](?'owner'\S+?)[\/](?'repository'\S+)$/gm
/*
https://github.com/rawkode/dotfiles
https://github.com/rawkode/dotfiles/2
git@github.com:rawkode/dotfiles
git@github.com:rawkode/dotfiles/micro/1/2
ssh://git@github.com/rawkode/dotfiles
ssh://git@github.com/rawkode/dotfiles/micro/1
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment