5 kyu

Extract the domain name from a URL

3,794 of 84,807xianpants

Description:

Write a function that when given a URL as a string, parses out just the domain name and returns it as a string. For example:

* url = "http://github.com/carbonfive/raygun" -> domain name = "github"
* url = "http://www.zombie-bites.com"         -> domain name = "zombie-bites"
* url = "https://www.cnet.com"                -> domain name = cnet"
Parsing
Regular Expressions

Stats:

CreatedMar 20, 2013
PublishedMar 21, 2013
Warriors Trained166588
Total Skips25147
Total Code Submissions538736
Total Times Completed84807
Ruby Completions3794
Python Completions43201
JavaScript Completions38314
COBOL Completions12
Total Stars2693
% of votes with a positive feedback rating83% of 6385
Total "Very Satisfied" Votes4684
Total "Somewhat Satisfied" Votes1286
Total "Not Satisfied" Votes415
Ad
Contributors
  • xianpants Avatar
  • jhoffner Avatar
  • GiacomoSorbi Avatar
  • dreadknight2008 Avatar
  • Chrono79 Avatar
  • Blind4Basics Avatar
  • akar-0 Avatar
  • dfhwze Avatar
  • saudiGuy Avatar
Ad