Help

The Community will be undergoing maintenance from Friday February 21 - Friday, February 28 and will be "read only" during this time. To learn more, check out our Announcements blog post.

Extract data from a form email

Topic Labels: Data Formulas
214 6
cancel
Showing results for 
Search instead for 
Did you mean: 
teri_d
4 - Data Explorer
4 - Data Explorer

Hi, we receive form emails in our airtable base. what's the best regex to use to extract information?

Email looks like this:

*Your Name* Jane Doe

*Organization* Best Company

*Your Job Title* Sales Manager

 

Thank you!

6 Replies 6
Milan_Automable
6 - Interface Innovator
6 - Interface Innovator

To extract the name:

 

REGEX_EXTRACT({Email Content}, '\\*Your Name\\* ([^\n]*)')

 

Do the same for the other fields, replacing "Your Name"  with the desired field name.

EmailMatchRegex.gif

Quick explanation: the part between the brackets (...) is the one we're matching for, [^\n] means anything other than a line break, and the star at the end matches any amount of these (non-linebreak) characters.

So this finds the line that start with *Your Name* and finds the rest of that line.

Hope this helps, good luck with your setup 🙂

-- Best, Milan - Automable.AI Free Airtable consultation

ScottWorld
18 - Pluto
18 - Pluto

@teri_d 

FYI: Instead of parsing the body of a email using formulas, there are typically more efficient & more straightforward ways of process incoming forms coming into Airtable.

Where are your forms coming from? You can typically use Make’s advanced automations (for 100% free) to automatically process your incoming forms for you and then parse the data into the proper Airtable fields.

For example, let’s pretend that your forms are being submitted through a Wix website. You could simply use Make’s Airtable integrations and Make’s Wix integrations to create an automation that looks like the screenshot below.

Furthermore, Fillout’s advanced forms for Airtable is 100% free and it is designed to directly communicate with Airtable — with no automations needed at all.

Hope this helps! If you’d like to hire the best Airtable consultant to help you with anything Airtable-related, please feel free to contact me through my website: Airtable consultant — ScottWorld 

IMG_0599.jpeg

Mike_AutomaticN
10 - Mercury
10 - Mercury

Hey @teri_d!

I'd love to pitch in my suggestion as well, in addition to insights shared by @ScottWorld and @Milan_Automable.

Regex is great in the sense that it is a pretty lean and straightforward solution. However, it also assumes that your data is super structured and formatted correctly every single time. However, if end users sending the emails do not format the email correctly every time, Regex might miss some of the data.

To extract specific data from unstructured text, you might want to give Airtable's AI field a try (Teams plan). You can find out more about the AI Field here.

Mike_AutomaticN_0-1739885323374.png

Within the field configuration, you can select the "Generate text" option, and then the "Start from scratch" option.

Mike_AutomaticN_1-1739885382349.png

For last, you can write the corresponding prompt for the corresponding field. Below see an example on how to extract email from field "Body".

Mike_AutomaticN_2-1739885568701.png

This might be overbuilding for your specific case, but just bringing it up in case it is helpful for someone 😄

Mike, Consultant @ Automatic Nation

Mike_AutomaticN
10 - Mercury
10 - Mercury

Additional comment @teri_d! Might or might not be related, but you'll probably find it interesting.

Airtable released a new trigger for automations: "When email received". You might want to check it out! 

Mike, Consultant @ Automatic Nation

ScottWorld
18 - Pluto
18 - Pluto

Oh yes, @Mike_AutomaticN, you just reminded me that I should've mentioned above that Make also offers custom mailhooks to receive emails as well, so if anybody hits up against the limitations of Airtable automations (such as not being able to combine repeating loops and conditional filtering), they can create more advanced automations with Make's mailhooks.

- ScottWorld, Expert Airtable Consultant

teri_d
4 - Data Explorer
4 - Data Explorer

Thanks, everyone! was able to make it regex work! But would definitely look into the other suggestions here. You guys are awesome!