Answers for "domain name regular expression"

1

domain regex

/^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,}$/
Posted by: Guest on August-23-2020
0

get domain name with regex

const urls = [
  'www.abc.au.uk',
  'https://github.com',
  'http://github.ca',
  'https://www.google.ru',
  'http://www.google.co.uk',
  'www.yandex.com',
  'yandex.ru',
  'yandex',
  'devmaster.auxitaplatform.com',
]

urls.forEach(url => console.log(url.replace(/.+\/\/|www.|\..+/g, '')))
Posted by: Guest on August-03-2021

Code answers related to "domain name regular expression"

Code answers related to "Javascript"

Browse Popular Code Answers by Language