Regex for extracting the Domain Name from URL

def domain_name(url)

 url.gsub(/.+\/\/|www.|\..+/i, )

end