Email Validator RE
Brick Robbins
brick at fastpack.com
Thu Nov 15 17:27:44 CST 2001
~sdpm~
I use this subroutine.
It checks for Valid Top Level Domains (including the new ones), and makes
sure domain names only contain valid characters
Stuff to the right of the @ may contain only alphanumeric, the dash and the
dot [\w\-\.]
Stuff to the left of the @ can contain any 7bit ASCII characters except space
#################################################
sub emailIsValid {
my $email = $_[0];
($email =~ m/\s/) && return 0; #no blank spaces allowed
in address
if ($email =~ m/\.com$/i || #check for valid
"non-country" TLDs
$email =~ m/\.edu$/i || # (ones longer than 2
letters)
$email =~ m/\.net$/i ||
$email =~ m/\.org$/i ||
$email =~ m/\.gov$/i ||
$email =~ m/\.mil$/i ||
$email =~ m/\.aero$/i ||
$email =~ m/\.biz$/i ||
$email =~ m/\.coop$/i ||
$email =~ m/\.info$/i ||
$email =~ m/\.museum$/i ||
$email =~ m/\.name$/i ||
$email =~ m/\.pro$/i
)
{
($email =~ m/^.+\@[\w\-\.]+\.\w{3,6}$/) && return 1;
}
($email =~ m/^.+\@[\w\-\.]+\.\w\w$/) && return 1; #valid 2 letter TLD
return 0;
}
######################################
--
Brick Robbins mailto:brick at fastpack.com
~sdpm~
The posting address is: san-diego-pm-list at hfb.pm.org
List requests should be sent to: majordomo at hfb.pm.org
If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at happyfunball.pm.org> with the following
command in the body of your email message:
unsubscribe san-diego-pm-list
If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at happyfunball.pm.org> .
This is the general rule for most mailing lists when you need
to contact a human.
More information about the San-Diego-pm
mailing list