The quest for an email validation script is becoming ancient and legendary. I'm sure somebody else already has sounded off on this, but the short answer is that there's no sure-way to validate email. There's any number of potential problems:

1. The email address does not conform to the RFC
2. The email address conforms but is not deliverable.
3. The email address conforms but does not exist.
4. The address conforms but does not belong to the person who submitted it.
5. The address may be technically invalid but still deliverable in practice.

If you just want a regular expression to validate that the string looks like email, that's fairly straightforward. In my opinion, the best you can do is validate that the username doesn't contain illegal characters, it's followed by an '@' and the suffix is properly formed.

Dylan Boudreau wrote:

The input must be an email address and I am checking it the following
way:

print "Enter an address to replace: ";
chomp (my $search = <STDIN>);
unless ($search =~ /@/){
die "Search field must be an email address!\n";
}
print "Enter a replacement address: ";
chomp (my $replace = <STDIN>);
unless ($replace =~ /@/){
die "Replacement field must be an email address!\n";
}

This does work but I am sure there must be a better way. The whole
program is a search and replace utility for email addresses on all our
mailing lists so when someone changes their address I don't need to
change it manually on 20 lists. Does anyone see a better way of doing
this?

Dylan



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to