Created
October 29, 2017 21:40
-
-
Save Sinequanonh/226f68dab9188c9a0746138d46536538 to your computer and use it in GitHub Desktop.
Extract the domain name from an url
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
module.exports = url => url.match(/^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n]+)/im)[1] | |
// https://github.com/ becomes github.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment