Aug 17, 2021 09:03 AM
If someone could help me with this, I’d be extremely grateful. I can’t figure this out.
This is what I"d like to achieve through a formula:
Most Track Titles have a name followed by a “space hyphen space” and a suffix.
I’d like to automatically delete everything after and including the “space hyphen space”.
If Track Title is not followed by “space hyphen space”, just copy the Track Title over.
Thank you so much for pointing me in the right direction.
Aug 17, 2021 09:14 AM
I have come this far, but it results in an #ERROR! for TRACK TITLE C:
> IF(
> {TRACK TITLE},
> SUBSTITUTE({TRACK TITLE},
> REGEX_EXTRACT({TRACK TITLE}," -.*"),""
> ))
Aug 17, 2021 09:39 AM
Welcome back to the Airtable community!
Regular expressions can be tricky to setup. Try this formula. It looks for a string of characters that are not hyphens and then trims any leading/trailing space.
TRIM(REGEX_EXTRACT({TRACK TITLE}, "[^-]*"))
The problem with this formula is that REGEX_EXTRACT
returns an error if the pattern does not have any matches.
Aug 17, 2021 09:59 AM
Thank you so much, kuovonne.
Would you mind adding your line of code to my formula? When I try to do it, I get formula syntax errors.
Thank you!
Aug 17, 2021 10:06 AM
My formula does not need to be embedded in your formula. It is a standalone formula.
Aug 17, 2021 10:10 AM
I just tried it. Works beautifully. Thank you so much!!