simple email address to domain check





-1
Date Submitted Thu. Aug. 31st, 2006 7:43 AM
Revision 1 of 1
Scripter ctiggerf
Tags Email | Perl | RegExp
Comments 0 comments
Just a simple check to make sure that a person's email address matches their domain.

For example .. in a form you have 2 textboxs .. 1 for their website url, the other for their email address. This checks to see if the domains for the email address and the website url match.

//first check to make sure the url looks like a url and the email
// looks like an email

my $domain;
if($form->{email} =~ m/@(.+)$/) { $domain=$1; }
if (($domain) && ($form->{site_url} =~ m/(?<![^.])\Q$domain\E$/ ))  {
   //the domains match
} else {
  //they do not match
}
 

Chris Falzone

www.eadexchange.com

Comments

There are currently no comments for this snippet.

Voting