Hello, to continue this thread, I’m wondering how can we manage the data, here’s my usecase :
I’m using the “text” from the Trigger Gmail Node, I’m wondering how can I extract data like : email, téléphone (phone), type de contrat (contract type), date de naissance (birth day) etc…
Are you guys thinking of a way to extract this data ? Maybe it’s better to use the “HTML text” ?
Hi, I don’t know if you found a solution but if it’s not the case you can use Regex.
That’s not simple but there are some generator online like https://regex101.com.
Here is my case for example.
I forward some mails to an email address reserved for n8n to do some automation. I need to retrieve the sender email address but it’s a forward so the sender is me… The real sender address is in the body like this:
(You can put /[\w.-]+@[\w.-]+\.[A-Za-z]{2,}/ in the regex101 website, it will explain what every part does).
This Regex seeks all the “@” characters and return it with what is before and after. The [0] at the end is to get the first occurence (if there is multiple results, change this number to get the others).
In my case, I could just as easily have used /<([^>]+)>/g that simply seeks what is between “<” and “>”. But my first Regex can suit your case !
For the phone you can use /^(?:(?:\+|00)33|0)\s*[1-9](?:[\s.-]*\d{2}){4}$/ that seeks all the phone numbers that starts with +33, 033 or 0 (like 01, 06,…), with spaces or no spaces between numbers.
The contract type can be /type de contrat\s*:\s*(\w+)/i.
And the birth date /^(\d{2})\/(\d{2})\/(\d{4})$/.
Note that I’m not a Regex expert and there are maybe some errors…