Mar 22, 2021 05:04 AM
**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
Solved! Go to Solution.
Mar 22, 2021 07:16 AM
Hi Jack. You need to replace {url} with the name of your field. Did you do that already?
Mar 22, 2021 05:39 AM
Hi Jack. Give this a try…
REGEX_EXTRACT({url}, ‘[^/]+$’)
Cheers!
Mar 22, 2021 07:12 AM
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.”
Mar 22, 2021 07:16 AM
Hi Jack. You need to replace {url} with the name of your field. Did you do that already?
Mar 22, 2021 07:20 AM
You need to change the curly quotes to straight quotes. '
.
Mar 22, 2021 07:33 AM
Wow - thank you so much. You were totally right! I really appreciate it
Mar 22, 2021 07:34 AM
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.
Mar 22, 2021 07:35 AM
I need new glasses! How many times has that been a problem that I’ve pointed out?!!?!?!
Mar 22, 2021 07:54 AM
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
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.
Mar 22, 2021 08:23 AM
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!