- Jochen Bern via dovecot:
I have a need of a "helper function" that takes a string someone would "want to send an e-mail to", i.e., something like an RFC 5322 "address" token, as used in a "To:" header, and extract just the actual e-mail address(es) from it.
Just to be sure: Do you mean extracting the "addr-spec" part as per https://datatracker.ietf.org/doc/html/rfc5322#section-3.4 from a string?
I found a certain number of *libraries* for various programming languages that offer such a functionality¹, but I would prefer an executable from some run-of-the-mill Linux/UNIX package to be called by shell command.
Anything capable of handling regular expressions immediately comes to mind, like "sed" or "awk". Minimal Perl or Python snippets will also do, but that's overkill if I understand your requirements correctly.
-Ralph