Skip to content

Instantly share code, notes, and snippets.

Created April 10, 2016 18:53
Show Gist options
  • Save anonymous/2b46a8f53be1a3e259c26813a9e13e7f to your computer and use it in GitHub Desktop.
Save anonymous/2b46a8f53be1a3e259c26813a9e13e7f to your computer and use it in GitHub Desktop.
# 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