
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 04, 2022 02:34 PM
I have a field called: Branch Name
I need to extract text from it using a formula field. I’m just not sure how.
Examples of data in the field:
#2828 - Clarksville Branch - Clarksville, TN
#4109 - Aiken Branch - Aiken, SC
What I need to extract:
Clarksville Branch
Aiken Branch
I tried this formula, but it doesn’t work (returns #ERROR!) and I don’t know enough about REGEX to troubleshoot:
REGEX_MATCH({Branch Name}, '/(?<=-).*(?=-)/g')
Solved! Go to Solution.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 04, 2022 08:23 PM
Here’s a Regex solution:
IF({Branch Name}, TRIM(REGEX_EXTRACT({Branch Name}, " (?:\\b)([^-]*)")))
A couple of Regex tips:
- You don’t need to wrap the regular expression in forward slashes. That’s only for some interpreters (e.g. JavaScript), and the one used by Airtable doesn’t support that.
- For testing, I recommend regex101.com . On that site, pick the Golang variant on the left before testing your expression, as that’s the interpreter that’s closest to what Airtable uses. Once your expression works, just copy the text and paste it into a string in the proper Airtable function. No extra wrapper characters needed, and Airtable will automatically add extra backslashes to escape any that are part of the expression.
- The
REGEX_MATCH()
function only tells you if there is a match in the string. To extract, useREGEX_EXTRACT()
.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 04, 2022 05:50 PM
Hi @Cady_Smith1
REGEX will certainly be more concise but I dont know REGEX. Here is a formula that will work assuming the data is always formatted the same.
LEFT(MID(TRIM({Branch Name}),FIND("-", TRIM({Branch Name}))+1, LEN(TRIM({Branch Name}))),FIND("-", MID(TRIM({Branch Name}),FIND("-", TRIM({Branch Name}))+1, LEN(TRIM({Branch Name}))))-1,LEN(MID(TRIM({Branch Name}),FIND("-", TRIM({Branch Name}))+1, LEN(TRIM({Branch Name})))))
No doubt there is a better way to do it though.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 04, 2022 08:23 PM
Here’s a Regex solution:
IF({Branch Name}, TRIM(REGEX_EXTRACT({Branch Name}, " (?:\\b)([^-]*)")))
A couple of Regex tips:
- You don’t need to wrap the regular expression in forward slashes. That’s only for some interpreters (e.g. JavaScript), and the one used by Airtable doesn’t support that.
- For testing, I recommend regex101.com . On that site, pick the Golang variant on the left before testing your expression, as that’s the interpreter that’s closest to what Airtable uses. Once your expression works, just copy the text and paste it into a string in the proper Airtable function. No extra wrapper characters needed, and Airtable will automatically add extra backslashes to escape any that are part of the expression.
- The
REGEX_MATCH()
function only tells you if there is a match in the string. To extract, useREGEX_EXTRACT()
.
