I would like to match just the root of a URL and not the whole URL from a text string. Given:
http://www.youtube.co
Well, doing using an regular expression will be a lot easier:
mainUrl = "http://www.mywebsite.com/mypath/to/folder"; urlParts = /^(?:\w+\:\/\/)?([^\/]+)(.*)$/.exec(mainUrl); host = Fragment[1]; // www.mywebsite.com