Click here to get back home

Trying to catch invalid emails

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Trying to catch invalid emails Samik R. 06-10-2008
Posted by Samik R. on June 10, 2008, 12:08 am
Please log in for more thread options
Hello,
I use the following regular expression to catch typical invalid email
addresses:
------------
my @Email=("sam._\@abc.org", "sam_.\@abc.org", "sam_.\@abc.org");
foreach (@Email)
{

if(/^[A-z0-9]+([_\.][A-z0-9\-]+)*[@][A-z0-9_\-]+([.][A-z0-9_\-]+)?\.[A-z]$/)
{ print "$_ is a valid email id\n"; }
else
{ print "$_ is an invalid email id\n"; }
}
-------------

This expression does not catch the above 3 emails in the array (the
program says that they are valid emails).

Can someone help me to discard these three?
Thanks.


Posted by Slickuser on June 10, 2008, 12:33 am
Please log in for more thread options
So you want
sam._@abc.org
sam_.@abc.org

to be invalid while

sam@abc.org
sam_a@abc.org
sam.b@abc.org
sam.a_b@abc.org??

> Hello,
> I use the following regular expression to catch typical invalid email
> addresses:
> ------------
> my @Email=("sam._\@abc.org", "sam_.\@abc.org", "sam_.\@abc.org");
> foreach (@Email)
> {
>
>
if(/^[A-z0-9]+([_\.][A-z0-9\-]+)*[@][A-z0-9_\-]+([.][A-z0-9_\-]+)?\.[A-z]$/)
> { print "$_ is a valid email id\n"; }
> else
> { print "$_ is an invalid email id\n"; }}
>
> -------------
>
> This expression does not catch the above 3 emails in the array (the
> program says that they are valid emails).
>
> Can someone help me to discard these three?
> Thanks.


Posted by Scott Bryce on June 10, 2008, 12:56 am
Please log in for more thread options
Samik R. wrote:
> I use the following regular expression to catch typical invalid email
> addresses:

Is there a reason that you are not using the Email::Valid module?

Posted by Ben Bullock on June 10, 2008, 2:34 am
Please log in for more thread options

> This expression does not catch the above 3 emails in the array (the
> program says that they are valid emails).
>
> Can someone help me to discard these three?

You asked the same question on May 7th 2008, and got a lot of replies:

http://groups.google.co.jp/group/comp.lang.perl.misc/browse_frm/thread/a807e473d83be073/d0e7a31a55bedb02?hl=en#d0e7a31a55bedb02

Perhaps if you don't understand the replies you got, you could try
asking for a clearer reply on that thread rather than asking exactly
the same question a month later.

Posted by szr on June 10, 2008, 4:18 am
Please log in for more thread options
Ben Bullock wrote:
>
>> This expression does not catch the above 3 emails in the array (the
>> program says that they are valid emails).
>>
>> Can someone help me to discard these three?
>
> You asked the same question on May 7th 2008, and got a lot of replies:
>
>
http://groups.google.co.jp/group/comp.lang.perl.misc/browse_frm/thread/a807e473d83be073/d0e7a31a55bedb02?hl=en#d0e7a31a55bedb02

(Sorry for nitpicking, but just for the sake of correctness, as all as
curiousness; did you get May 7th from a time zone localization or was
there another reason?)

Actually it was posted on May 6th, 2008:

Newsgroups: comp.lang.perl.misc
Subject: Trying to catch invalid emails
Date: Tue, 06 May 2008 20:58:25 -0600


--
szr



Similar ThreadsPosted
Trying to catch invalid emails May 6, 2008, 10:58 pm
Help with Sending Multiple Emails! October 6, 2004, 2:54 pm
deciphering emails in PERL October 21, 2004, 9:54 pm
Saving attachments from emails October 22, 2004, 12:25 pm
How to generate random emails? February 24, 2005, 11:35 am
Receiving emails with attachments April 8, 2006, 2:26 pm
GD::Graph Invalid Data from DBI July 10, 2005, 12:28 am
XML::LibXML findnodes Invalid Expression September 10, 2005, 8:13 am
Invalid length of line read.... April 26, 2006, 2:36 am
Archive::Zip - zip file has "invalid" format October 5, 2006, 9:41 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap