Created
August 2, 2013 01:01
-
-
Save tleen/6136736 to your computer and use it in GitHub Desktop.
Extract main portion of hostname from url in node javascript without regex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url.parse('http://some.long.hostname.here.com/andpages.html').hostname.split('.').reverse().slice(0,2).reverse().join('.'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment