I’m having some problems on good old Codewars, writing a method that can
take a URL and return just the domain.
I’ve managed to create a Regex in Rubular
(Rubular: https*:\/\/w*\.*(\w*\-*\w*).)
that passes my tests, but I’m having trouble implementing it properly.
You could adjust the regexp to match a given set of domains domain
names[1]. But the problem is unsolvable using regular expressions[2]. In
theory you should create a list with all the available domain names,
(maybe a google search will even give you a TXT file) and then write a
complicate set of instructions to match those. Only this way you might
get a complete solution IMHO.