Issue
If I have a web url with following https://github.com/myorg/myrepo.git
How can I retrieve only between the first and second slash "myorg" using regex ?
I have looked up few and only found the how to retrieve last piece using | sed 's#.*/##'
Solution
Not a regex but very simple
echo https://github.com/myorg/myrepo.git | awk -F\/ '{print $4}'
Slightly more flexible as it get's the next to last field:
echo https://github.com/myorg/myrepo.git | awk -F\/ '{print $(NF-1)}'
Answered By - chipfall