Help

Turning last part of URL into Primary Field

Topic Labels: Formulas
Solved
Jump to Solution
3115 9
cancel
Showing results for 
Search instead for 
Did you mean: 
Jack_Campbell
5 - Automation Enthusiast
5 - Automation Enthusiast

**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 Solution

Accepted Solutions

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

See Solution in Thread

9 Replies 9
augmented
10 - Mercury
10 - Mercury

Hi Jack. Give this a try…

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

Cheers!

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

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?

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

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?!!?!?!

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.

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!