re: Daily Challenge #89 - Extract domain name from URL VIEW POST

FULL DISCUSSION
 

My solution in js

const domainName = (url) => {
  const match = url.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i);
  return (match && match.length > 2 && typeof match[2] === 'string' && match[2].length) ? match[2].split('.')[0] : null;
}
code of conduct - report abuse