Whenever you need some reasonably common matching problem resolve in Perl, you should always first check the Regexp::Common
family on CPAN. In this case: Regexp::Common::Email::Address
. From POD Synopsys:
use Regexp::Common qw[Email::Address];
use Email::Address;
while (<>) {
my (@found) = /($RE{Email}{Address})/g;
my (@addrs) = map $_->address, Email::Address->parse("@found");
print "X-Addresses: ", join(", ", @addrs), "
";
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…