I want to get a specific part of a url between the third and fourth slashes of a link on the page.
EDIT: Sorry I don\'t think I was clear the first time, I meant get
var getSegment = function (url, index) { return url.replace(/^https?:\/\//, '').split('/')[index]; }
Usage:
getSegment("http://domain.com/a/b/c/d/e", 4); // "d"
The replace makes sure that the first two slashes after the protocol (http or https) don't count.
replace
http
https