I have a simple email validation regex to create.
For the moment I have this:
#! /usr/bin/env perl
print "mail from: ";
my $mail_from = lc(<STDIN>);
if ($mail_from =~ /(([^@]+)@(.+))/) {
$mail_from = $1;
print $mail_from;
print "250 OK\n";
}
else{
print "550 ERROR \n";
}
But the problem is that I can enter various character after the .com like me@gmail.com blabla
How can I match the string until the first whitespace ?
Regards,