Extract shipping address from an email

I am trying to extract a shipping address from emails received in a consistent format.

Attached is a screenshot of the emails. I have blanked out the address details.

I am trying with the parser module, but must be doing something wrong.

All I need are the 4 lines after ‘Shipping Address’ and before ‘United Kingdom’

Thanks!

Hey @_Elliott
welcome to the make community

Use this formula
This will give you the text after ‘Shipping Address’ and before ‘United Kingdom’

(?:Shipping Address\n)((?:.*\n){1})(?:United Kingdom)

2 Likes

Hey @Abhishek

Thanks so much for your response

I tried this, and am still getting no data, do you have any ideas?

The module I have before is watching for emails, and is correctly showing the address in the text content string.

Thanks,
Elliott

When reaching out for assistance with your regex pattern for a Text Parser module, it would be super helpful if you could share the actual text you’re trying to match. Screenshots of text can be a bit tricky, so if you could copy and paste the text directly here, that would be awesome! It ensures we can run it against test patterns effectively. If there’s any sensitive info, feel free to change it to something fictional yet still valid by keeping the format intact.

Providing clear text examples saves time on both ends and helps us give you the best possible solution. Without proper examples, we might end up playing a guessing game, and nobody wants that as it is a waste of time! You are more likely to get a correct answer faster. So, help us help you by sharing those text snippets. Thanks a bunch!

3 Likes

Hi @samliew
Thanks for your message.
Copy and paste of the text here (my details, not a customer)

Customer

Shipping Address

Elliott Hale
188a Church Road
Brighton, BN32DJ
United Kingdom

Hope this helps

Elliott

@_Elliott

You can also try the replace function here
Screenshot 2024-02-14 184143

Screenshot 2024-02-14 184156

2 Likes

You can use a Text Parser “Match Pattern” module with this regular expression pattern

Address\s+(?<address>[\w\W]+?)United Kingdom

Regex test: https://regex101.com/r/pj4BV3

Important Info

  • :warning: Global match must be set to YES if you want to match more than one!


For more information, see Text Parser in the Make Help Center:

Match Pattern
The Match pattern module enables you to find and extract string elements matching a search pattern from a given text. The search pattern is a regular expression (aka regex or regexp), which is a sequence of characters in which each character is either a metacharacter, having a special meaning, or a regular character that has a literal meaning.

Hope this helps!

4 Likes

Thankyou!!! @samliew

2 Likes