Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Regex in Airtable is so frustrating. Help with string.

Topic Labels: Regular Expressions
53 2
cancel
Showing results for 
Search instead for 
Did you mean: 

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?
2 Replies 2
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.