I’m currently working on a project where I need to parse specific pieces of information from emails using regex, but I’ve encountered some challenges. I would greatly appreciate any guidance or insights you could provide.
Objective: I want to extract the following pieces of information from an email:
- Product Option (e.g., “eSIM USA 1GB 7Days”)
- Unique ID (e.g., “124874818726”)
- Main Customer’s Name (e.g., “Adam Jeo”)
- Customer’s Email Address (e.g., “customer-d6s7f6ds7678ds67@reply.getyourguide.com”)
Email Sample:
Hi supply partner,
Great news! The following offer has been booked:
eSIM USA for Travelers: (USA-eSIM-EU01)
Option: eSIM USA 1GB 7Days (124874818726)
View booking
Most important data for this booking:
Date: 03 February 2024
Price: € 13.77
Number of participants:
1 x Adult (Age 0 - 99 ) (€ 13.77)
Reference number: XXX8HDJ3
Main customer:
Adam Jeo
Romania
customer-d6s7f6ds7678ds67@reply.getyourguide.com
Phone: +4174356XXXX
Best regards,
The GetYourGuide Team
Attempted Regex Pattern:
I’ve tried constructing a regex pattern to capture these details, but it doesn’t seem to match the subject string as expected. Here’s my latest attempt:
Option:\s*(.+)\s*\((\d+)\).*Main customer:\s*(.*)\n\n.*(\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b)
Specific Questions:
- Is there a more effective way to structure this regex to ensure it captures all the required information from the email text?
- Are there special considerations I should be aware of when using regex within Make.com, particularly regarding multi-line strings and non-greedy matching?
Any advice, sample patterns, or resources you could share would be immensely helpful. Thank you in advance for your time and assistance!