Created
October 8, 2013 11:35
-
-
Save callblueday/6883370 to your computer and use it in GitHub Desktop.
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
/** | |
* Get domain name from url | |
* eg: 'http://123.blog.163.com/123/123.html' | |
*/ | |
getDomainName = function(url_str) { | |
return url_str.match(/(\w+\.(?:com|cn|net|org|cc|so|be|me|io|edu|gov|info|tv|museum|coop|aero| | |
int|biz|name|pro|aero|travel|jobs|mobi|jp|hk))(?:\/|$)/)[1]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment