Extract string between two characters

estrarre testo compreso tra due caratteri delimitatori non necessariamente uguali

 

 

 

 

For example I want to see mail boxes logins, each login row is similar to this:

Nov 26 12:17:52 sgherro_mail_server dovecot: imap-login: Login: user=<usermailbox>, method=PLAIN, rip=192.168.0.225, lip=192.168.99.216, TLS

 

To extract usermailbox I did this:

cat /var/log/mail.log | grep "Login: " |sed -nr 's/.*<(.*)>.*/\1/p'