Nov 16, 2018 06:15 AM
Is there any way to change different versions of domains to its root domains?
example:
If we add
Column 1
https://www.domain.com/
https://domain.com/
https://www.domain.com
https://domain.com
http://www.domain.com/
http://domain.com/
http://www.domain.com
http://domain.com
Column 2 Result in all rows of above
domain.com
Solved! Go to Solution.
May 18, 2022 08:54 AM
Hey, @Brian_Moran
Sorry, I’m just seeing this. Luckily, in the 4 years since I wrote that formula you are referencing, Airtable has added some REGEX
functions that should help with that.
Perhaps try replacing the entire SEARCH('com/', URL)
function with this:
REGEX(URL, "[com|org|net|ie|io]/")
If that works, you can continue to add any other tld’s you might need inside those brackets, separated by a ‘pipe’ character |
.
May 18, 2022 09:10 AM
Thanks Jeremy! I’ll give that a try and report back!
May 24, 2022 07:58 AM
I ended up needing to just get rid of the www. or https:// and such AND a trailing “/” IF there was one, hope it helps!
LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(URL, "http://",""), "https://",""), "www.", ""),
IF(RIGHT(URL,1)="/",
LEN(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(URL, "http://",""), "https://",""), "www.", ""))-1,
LEN(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(URL, "http://",""), "https://",""), "www.", ""))
))
Jul 11, 2022 03:35 PM
Thanks! I used this and it worked great. It saved me a bunch of time to look up something someone shared instead of reinventing it myself.
Mar 16, 2023 04:59 AM
This removes subdomains, folders, etc and doesn't output anything if there is no url.
IF({url}="","",REGEX_EXTRACT( {url}, '^(?:https?:\\/\\/)?(?:[^@\n]+@)?(?:www\\.)?(?:[^.]+\\.)?([^:\\/\n?]+\\.[^:\\/\n?]+)'))
Dec 15, 2023 09:35 AM
This worked very well, thank you