I am trying to extract a list of emails from a given text. Most of emails has the following syntax:
"Last_name, First_Name (First-name)" <last_name.first_name@domain.xxx>
or
"Last_name, First_Name (XXXX)" <last_name.first_name@domain.xxx>
My goal is to extract the whole emails including the first part, meaning the "Last_name, First_Name (XXXX)".
To extract the list of emails, I have used the following regex:
"(<?[a-z0-9!#$%&*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`"
"{|}~-]+)*(@|\sat\s)(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(\.|"
"\sdot\s))+[a-z0-9](?:[a-z0-9-]*[a-z0-9]>?)?)"
which extract only the emails without the first part. Meaning that extract only the:
<last_name.first_name@domain.xxx>
I have tried several variations of the regex to extract the first part but unfortunately they doesn't work.
Please do not hesitate If you have any suggestion. Thank you in advance.