Question

Extract Text from Email without parsing

  • 20 July 2022
  • 3 replies
  • 2300 views

Hi, within the text below I want to extract:

1. the 5-digit code after the string ‘homi.one ‘, i.e. 12345

2. the mobile number i.e. +3069xxxxxxxx

3. the first name Jane

4. the surname Doe

The text is the body_plain of text extracted from Gmail for enquiries from customers.

The order of info should remain the same

How can I do this? I am using the text formatter, and I think I may need to use the extract pattern, or split text, but not sure where to go from there.

Any help would be greatly appreciated

I have tried parsing, but I had a LOT of trouble, and the parser was always getting it wrong. 

Body_plain

Visit request for the following listing.

# homi.one 43866

Suburb (Region)

Property 41 m<sup>2</sup> for sale

€42,000

https://www.site.com/abc

I really like this property.
Please send me more information.
It will be me and my two dogs. 

Jane Doe

+3069xxxxxxxx (All day)

abc@defg.hij

 


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 7
Badge +14

Hi @Christian Homi 

Good question.

Check out this related topic for using a Code step to parse data:

 

Userlevel 7
Badge +12

Hi @Christian Homi!

 

You could set up a Zap using the Formatter app with split text as the ‘transform’ option. If you use [:new-line:] as the separator that would add each line of text to a separate field. If you then need to split the text further (eg getting the 5 digit number) you could either add another split text step (using space as a separator) to break the text down further, or you could use an extract pattern step. You could also use the Extract phone number transform to pull out the phone number in the email. One thing I will say is that splitting text using line breaks or spaces is very unforgiving of any changes in format. For example, if someone adds a line break in their message to you, any data after that (eg the name, phone number and email) will be in the wrong place in the Zap. 

I understand that you’re really fed up with the Email Parse, but could I just double check a couple of things? Have you tried adding more than one template to the Parser inbox? You can also log into Parser and tell it when it got an email wrong. Both of these things can improve the accuracy of your template. Have you tried either of those things? Adding more templates is something that I’d particularly advise - 3 to 4 templates is a good number. 

 

I hope that helps!

Userlevel 7
Badge +9

Hey @Christian Homi! Also coming in to add that if you have control over how the body of that email is generated (some apps allow you to customize this) you might be able to take advantage of our “named variables” functionality: https://zapier.com/help/create/customize/split-up-trigger-data-in-zaps