Regex to capture email id which start just after some special string -


i have many thunderbird exported file. need collect email id each file. emails bounced email id, thats why need remove them our system.

the string

reporting-mta: dsn; a27-19.smtp-out.us-west-2.amazonses.com  action: failed final-recipient: rfc822; mrinalkantighosh005@gmail.com  diagnostic-code: smtp; 550-5.1.1 email account tried reach not exist. please try 

every email id start final-recipient: rfc822; mrinalkantighosh005@gmail.com

so format final-recipient: rfc822; email_id_here

can guys please let me know regex extract email id.

thanks in advance.

update:
able extract email ids. regex selecting email ids:-

(?:[a-z0-9!#$%&'+/=?^_{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_{|}~-]‌​+)*|"(?:[\x01-\x08\x‌​0b\x0c\x0e-\x1f\x21\‌​x23-\x5b\x5d-\x7f]|\‌​[\x01-\x09\x0b\x‌​0c\x0e-\x7f])")@(?:(‌​?:[a-z0-9](?:[a-z0-9‌​-]*[a-z0-9])?\.)+[a-‌​z0-9](?:[a-z0-9-]*[a‌​-z0-9])?|[(?:(?:‌​25[0-5]|2[0-4][0-9]|‌​[01]?[0-9][0-9]?)\.)‌​{3}(?:25[0-5]|2[0-4]‌​[0-9]|[01]?[0-9][0-9‌​]?|[a-z0-9-]*[a-z0-9‌​]:(?:[\x01-\x08\x0b\‌​x0c\x0e-\x1f\x21-\x5‌​a\x53-\x7f]|\[\x‌​01-\x09\x0b\x0c\x0e-‌​\x7f])+)]) 

but need capture email id start after "final-recipient: rfc822;" string.

for matching after want can use look-behind assertion. since assertion has zero-length , not matching anything, can put patten after look-behind assertion. this:

(?<=final-recipient: ).*com

note
not appropriate pattern matching email want see look-behind assertion


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -