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
Here's the jQuery one-liner:
$('').attr('href', url).prop('hostname');