Last active
December 30, 2015 13:01
-
-
Save ManasJayanth/5ed584315093c1eda37f to your computer and use it in GitHub Desktop.
RegExp to extract domain from a url
This file contains hidden or 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
| function extractDomain(url) { | |
| return url.match(/(www\.)?([a-z0-9]+\.)+[a-z]{2,}/)[0]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment