Turning last part of URL into Primary Field

**Solution **
REGEX_EXTRACT({url}, ‘[^/]+$’)
Note: replace “URL” with column’s NAME and make sure the single quotation marks are STRAIGHT.

Hi Airtable Community,

TL;DR I’m trying to write a formula that’ll turn part of a URL into a Primary Field

Specifically, I have a list of URL’s like below. I need to separate the last bit of each URL (e.g. shopify, how to use, square vs paypal, what is credit card processing) and automate it into the Primary Field name - leaving out everything before it. The problem I’m unable to solve is that the part after the main URL is variable. For example, in https://www.usnews.com/360-reviews/credit-card-processing/what-is-credit-card-processing the emboldened part varies in each URL, making it hard to remove it with a formula

1 Like

Hi Jack. Give this a try…

REGEX_EXTRACT({url}, ‘[^/]+$’)



Unfortunately it didn’t work - thank you for trying to help me though :slight_smile:

It says “Sorry, there was a problem saving this field. Invalid formula. Please check your formula text.”

Hi Jack. You need to replace {url} with the name of your field. Did you do that already?

1 Like

You need to change the curly quotes to straight quotes. '.

1 Like

Wow - thank you so much. You were totally right! I really appreciate it

That’s amazing - thank you! Really appreciate your help!

Also…do you know how to capitalize the first letter? Not being lazy. I’ve been trying and don’t see it in the Airtable guide.

I need new glasses! How many times has that been a problem that I’ve pointed out?!!?!?!

1 Like

You will need to use a combination of functions. In the interest of teaching you to fish versus giving you a fish, here is the logic you need

  • extract the first character and make it upper case
  • extract all the remaining characters
  • concatenate the two parts together

And here are the functions you will need:

  • LEFT(string, howMany) will let you extract the first letter/character.

  • UPPER(string) will convert a string to upper case.

  • & will concatenate the upper case first character with the rest of the string

  • RIGHT(string, howMany) will let you extract all the characters at the end of the string.

  • LEN(string) will help you calculate “howMany” characters to put in to the RIGHT function…

All of these functions are documented in the formula field reference.

This support article also shows how to nest functions inside each other to build more complex functions.

1 Like

Thank you for this - I am indeed happy to learn how to fish. I will let you know if I need another hint. And thanks again!

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.