Skip to main content

I am trying to extract text from gmail. I have a zap started with Email Parser. Then a step using Formatter to extract separate pieces. I can extract the email address and amount with success. I’m trying to extract a FirstName LastName pattern that always comes after an exclamation point and line breaks. I cannot get this to work. I can get different versions to work in Regex101.com using Python flavor. But when I put it in the zap it includes the text I want excluded.

I have no idea what I’m doing wrong. I am no expert in regex so please be kind. I’m sure there’s something very basic that I’m missing. Any help would be most appreciated. Thanks in advance!

 

Email text:
 

Hi name,

Congratulations!

FirstName LastName donated $10.00 to ….. 

 

Here’s the latest iteration of the regex I’ve been trying:

\W{2}(?P<name>.+?) donated\s(?P<amount>.+)\sto

What I want is

name: FirstName LastName

amount: $10.00

 

What I’m getting is:

name: Congratulations! FirstName LastName

amount: $10.00

 

I’ve also tried this which again, works elsewhere but not in my zap.

\b\s*(.+?)\s* donated

 

Hi @lisa_nativegov 

Good question.

Have you tried asking ChatGPT for help with the RegEx.

 

Another option is to use this Zap action: ChatGPT - Extract Structured Data