* Wizard <wizard at neonedge.com> [2003-02-11 10:17]: > > Why not use Email::Valid? > > As I said in another email, this is for NMS, so I can't use anything that > doesn't come with the standard 5.0004(?) perl.
Ah, I see. OK, then, I have a small module (Email.pm) that rips off
from Email::Valid (I think, or it might have been an old version of
Email::Find), which I'll attach. It uses a large part of Jeffrey
Friedl's RFC822 regex. It will probably do what you want:
use Email; # make a better package name
my $e = Email->new('Wizard <[EMAIL PROTECTED]>');
print $e->user; # wizard
print $e->host; # neonedge.com
# To validate chunks of an address:
my @hostpieces = split /\./, $e->host;
It requires 5.005 (it uses qr), not 5.004.
(darren)
--
Maybe that's the only truth in the world. Not the Bibles or poetry or
philosophy but just the old jokes.
-- Robert Shea and Robert Anton Wilson
Email.pm
Description: Perl program

