本文介绍了用于从网站中提取域的 Google Sheets 公式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

REGEXEXTRACT(A1:A,"(?m)http(?:s?):\/\/.*?([^\.\/]+?\.[^\.]+?)(?:\/|$)")

尝试从网站中提取域

如果链接是这样的,上面的公式对我有用:


更新 1:

=ARRAYFORMULA(IFNA(REGEXEXTRACT(INDEX(SPLIT(REGEXREPLACE(A8:A14, "https?://www.|https?://|www.", ), "/"),,,1),\.(.+\..+)"), INDEX(SPLIT(REGEXREPLACE(A8:A14, "https?://www.|https?://|www.", ), "/"),,,1)))

更新 2:

=INDEX(IFERROR(REGEXEXTRACT(A1:A, "^(?:https?:\/\/)?(?:ftp:\/\/)?(?:www\.)?([^\/]+)")))

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))

UPDATE 1:

=ARRAYFORMULA(IFNA(REGEXEXTRACT(INDEX(SPLIT(
 REGEXREPLACE(A8:A14, "https?://www.|https?://|www.", ), "/"),,1),
 "\.(.+\..+)"), INDEX(SPLIT(
 REGEXREPLACE(A8:A14, "https?://www.|https?://|www.", ), "/"),,1)))

UPDATE 2:

=INDEX(IFERROR(REGEXEXTRACT(A1:A, "^(?:https?:\/\/)?(?:ftp:\/\/)?(?:www\.)?([^\/]+)")))

这篇关于用于从网站中提取域的 Google Sheets 公式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 12:25