Help

Re: Regex in Airtable is so frustrating. Help with string.

1695 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Stephen_Joslyn
5 - Automation Enthusiast
5 - Automation Enthusiast

I wish Airtable Regular expressions followed some common flavours so we could test it with regex101.com

I can make it work in these builders, but then when it comes back to Airtble #ERRROR. It's a huge potential but otherwise Airtable makes it hard to figure out why it isn't working.

I am trying to pull out the Patient's name from a Text extract. It always occurs after "Patient's name: " & before "Birthdate:"

Example string:
Radiology Report Patient’s name: Barney (57493) Birthdate: 7/5/2013 

One Regex101.com, and regextester.com I can get it perfectly with this regex:
(?<=name: )(.*)(?= Birthdate: )

But when I put that in airtable:

REGEX_EXTRACT({PDF Text Extraction}, "/(?<=name: )(.*)(?= Birthdate: )")
 
I get a big fat #ERROR
 
I know it's me but can anyone point me int he direction of a regex tester that is compatible with Airtable?
Or tell me what I can use here?
3 Replies 3
Matthew_Lanni
7 - App Architect
7 - App Architect
This should do the trick, I think: REGEX_EXTRACT({PDF Text Extraction}, "Patient's name: (.*?) Birthdate:")
 
As for testing, I find that Google Sheets gives far better error messages and uses the same syntax (as far as I've seen), so that's what I use to figure it out before putting it into Airtable.

Airtable REGEX formula functions are based on Google's RE2 library, which does not support the before/after features you are trying to use, among other things. It is the same library that Google Sheets uses.

If you stick to "simpler" regex expressions you should be okay. 

sistemas_urbita
6 - Interface Innovator
6 - Interface Innovator

Something as simple as this fails in Airtable:

REGEX_MATCH('123','/^\\d{3}$/')

very frustrating indeed