Skip to content

Instantly share code, notes, and snippets.

@pete0emerson
Created May 18, 2011 03:19
Show Gist options
  • Save pete0emerson/977937 to your computer and use it in GitHub Desktop.
Save pete0emerson/977937 to your computer and use it in GitHub Desktop.
Email regex template
#!/usr/bin/perl -w
use strict;
my @emails = qw/
petetheemersons.org
p
p@
p@t.
@
@t.e
@theemersons.org@
pete@the..emersons.org
p@t@theemersons.org
pete@theemersons.org
pete-pete@theemersons.org
pete@the-emersons.org
pete-pete@the-emersons.org
pete-pete@awesome.a.b.c.d.the-emersons.org
pete+nospam@theemersons.org
PETE+CAPITAL@THEEMERSONS.ORG
/;
my $index = '1';
foreach my $email (@emails) {
printf("%2.0d ", $index);
if ($email =~ /REGEX/) {
print "PASS: $email\n";
} else {
print "FAIL: $email\n";
}
$index++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment