How to use regex groups in Airtable formula expressions

I’m trying to pull out just the filename from a text field using regex patterns. My regex works fine when I test it online but keeps failing in Airtable.

The pattern I want to use is (?:[\\])(.*) which should match everything after a backslash character.

Here’s my sample data: Project Files - Archive 📁 - documents [123456789012345678].csv_Data\photo_2023-A45BC.PNG

My current formula looks like this: REGEX_EXTRACT({File_Path}, '(?:[\\])(.*)') but it throws an error.

When I use a simpler pattern like REGEX_EXTRACT({File_Path}, '[0-9A-Za-z]*\.[0-9A-Za-z]*') it works and returns ‘Project Files’ successfully. But as soon as I try using groups with REGEX_EXTRACT({File_Path}, '(?>[0-9A-Za-z]*)(\..*)') I get #ERROR again.

Can anyone tell me if Airtable actually supports regex capture groups? What might I be doing incorrectly here?

Airtable’s REGEX_EXTRACT is pretty limited compared to other tools. Hit this same issue last year building a file management system.

Your escaping’s the problem. Airtable needs double backslashes to match a literal backslash. Try:

REGEX_EXTRACT({File_Path}, '\\(.*)$')

This grabs everything after the last backslash. The $ makes it go to the end of the string.

With your sample data, you’ll get photo_2023-A45BC.PNG.

Want just the last part after a backslash? Use:

REGEX_EXTRACT({File_Path}, '\\([^\\]+)$')

This matches everything after the last backslash that isn’t another backslash.

Watch out - Airtable’s regex engine doesn’t support fancy features you see online. Stick to basic capture groups. Skip lookaheads or atomic groups - they’ll give you that #ERROR.