get domain name with regex

Solutions on MaxInterview for get domain name with regex by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "get domain name with regex"
Millicent
08 Oct 2016
1const urls = [
2  'www.abc.au.uk',
3  'https://github.com',
4  'http://github.ca',
5  'https://www.google.ru',
6  'http://www.google.co.uk',
7  'www.yandex.com',
8  'yandex.ru',
9  'yandex',
10  'devmaster.auxitaplatform.com',
11]
12
13urls.forEach(url => console.log(url.replace(/.+\/\/|www.|\..+/g, '')))