Created
April 10, 2016 18:53
-
-
Save anonymous/2b46a8f53be1a3e259c26813a9e13e7f 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
# Write a function that when given a URL as a string, parses out just the domain name and returns it as a string. | |
def domain_name(url) | |
url.gsub!(/https?:\/\/w?*\.?/, "") | |
url.gsub!(/\..{2,4}\/?.*/, "") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment