Yes, it is possible, and, yes, you could do it with RIGHT()
. The problem comes in finding that last ‘/
’.
You don’t say how standard the URLs you are trying to parse are. (For instance, if they all come from the same website, you’d know how many '/
's you have to skip before FIND()
ing the last. Or if they come from a handful of sites, you could specify the estartFromPosition]
argument to FIND()
based on domain.)
However, if you are looking at a collection of arbitrary URLs with an unknown (but assumed maximum) number of embedded '/
's, then you’re looking at a more complex algorithm. Since Airtable currently does not support loop processing, you’ll have to count the number of '/
's in the URL and then craft a formula that steps through the URL a set number of times until the last ‘/
’ is located, and then plug that number into a MID()
or RIGHT()
function.
In this reply I give examples of a multi-branched formula to parse a collection of hashtags, which is structurally similar to a URL. Fortunately, once you have the basic formula down, extending it to support your assumed maximum number of '/
's is only annoying, not complicated. :winking_face:
Hi,
I came here searching for an answer to this exact question, how to extract a string that follows the last instance of a certain character. In my case, I have a field containing a string like "TB2023-12-19-9-R-BB26", and I want to extract everything after the last "-", in this case "BB26". I could use a RIGH() function to extract the last four characters, but since it is based on a "count" field, the length will increase with time. Therefore, I first need to find how many characters there are after the last "-" and then extract that number from the string.
Here is my solution in a single code:
RIGHT({Field}, LEN({Field}) - FIND("}", SUBSTITUTE({Field}, "-", "}", LEN({Field}) - LEN(SUBSTITUTE({Field}, "-", "")))) )
Works like a charm! 😄