REGEXEXTRACT(A1:A,"(?m)http(?:s?):\/\/.*?([^\.\/]+?\.[^\.]+?)(?:\/|$)")
Trying to extract domain from website
The formula above has worked for me if the link is like this: https://walmart.com/careers
However, it doesn't work if it's already a domain (walmart.com) or if it's www.walmart.com/careers
Is there a more thorough formula that can allow for these edge cases?
try:
=ARRAYFORMULA(INDEX(SPLIT(REGEXREPLACE(A8:A12, "https?://www.|https?://|www.", ), "/"),,1))
=ARRAYFORMULA(IFNA(REGEXEXTRACT(INDEX(SPLIT(
REGEXREPLACE(A8:A14, "https?://www.|https?://|www.", ), "/"),,1),
"\.(.+\..+)"), INDEX(SPLIT(
REGEXREPLACE(A8:A14, "https?://www.|https?://|www.", ), "/"),,1)))
=INDEX(IFERROR(REGEXEXTRACT(A1:A, "^(?:https?:\/\/)?(?:ftp:\/\/)?(?:www\.)?([^\/]+)")))