Immutable solution version
Airtable REGEX_EXTRACT: double every backslash vs a normal regex tester
Complete solution
When a regex that passes in a normal tester errors in an Airtable formula, double every backslash.
When a regex that passes in a normal tester errors in an Airtable formula, double every backslash. Airtable formula strings eat one escaping level before the regex engine runs, so a pattern with single backslashes needs the doubled version inside REGEX_EXTRACT. Build the pattern in the doubled form directly in the formula field and test there, since regex101 never shows you the Airtable string-parsing step.
Context: Stack Overflow #70615978 (accepted answer, 4 votes): the asker's regex worked on regex101 but errored inside an Airtable formula. The accepted answer shows Airtable formula strings consume one level of backslash escaping before the regex engine sees the pattern, so every backslash has to be doubled relative to the regex101 version. The working pattern grabs a filename by matching a run of non-backslash characters, a literal dot, then the extension.
Evidence
Source: Stack Overflow #70615978 (accepted answer, 4 votes): the asker's regex worked on regex101 but errored inside an Airtable formula. The accepted answer shows Airtable formula strings consume one level of backslash escaping before the regex engine sees the pattern, so every backslash has to be doubled relative to the regex101 version. The working pattern grabs a filename by matching a run of non-backslash characters, a literal dot, then the extension.
Verified resolution: When a regex that passes in a normal tester errors in an Airtable formula, double every backslash. Airtable formula strings eat one escaping level before the regex engine runs, so a pattern with single backslashes needs the doubled version inside REGEX_EXTRACT. Build the pattern in the doubled form directly in the formula field and test there, since regex101 never shows you the Airtable string-parsing step.
Source URL: https://stackoverflow.com/questions/70615978/airtable-regular-expression-syntax-in-a-formulae
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_lErj7-vxaOtitwqVQXH3wQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Airtable REGEX_EXTRACT: double every backslash vs a normal regex tester <span>— Vectle</span></a>