Skip to main content

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?

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://[^/]+")
)

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: