Help

How to remove everything after a root domain URL

Solved
Jump to Solution
1355 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Katharina_Somme
4 - Data Explorer
4 - Data Explorer

Hi all, I’m trying to create a formula that helps me trim a product specific link to its root website link.

For example, I have: https://freestar.co/products/12-x-bottles
And want to get: https://freestar.co

In some cases, the links are https://www. and sometimes they are are above (without the www).

Could you help me out?

1 Solution

Accepted Solutions
kuovonne
18 - Pluto
18 - Pluto

Welcome to the Airtable community,

This is a great use case for regular expressions.
If all of your urls will begin with “https”, you could use this formula

IF(
  REGEX_MATCH({url}, "https://[^/]+"),
  REGEX_EXTRACT({url}, "https://[^/]+")
)

See Solution in Thread

2 Replies 2
kuovonne
18 - Pluto
18 - Pluto

Welcome to the Airtable community,

This is a great use case for regular expressions.
If all of your urls will begin with “https”, you could use this formula

IF(
  REGEX_MATCH({url}, "https://[^/]+"),
  REGEX_EXTRACT({url}, "https://[^/]+")
)

Thank you @kuovonne - this worked perfectly! :clap: