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. 05-06-2008
Posted by Frank Seitz on May 7, 2008, 5:09 am
Please log in for more thread options
Abigail wrote:
> _
> Samik R. (samik@frKKshKll.org) wrote on VCCCLXIII September MCMXCIII in
> :) 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?
>
> Sure.
>
> if (/_/) {
> print "$_ is invalid";
> }
> else {
> print "$_ is valid";
> }

An e-mail address with _ (or ._ or _.) isn't invalid, AFAIK.

Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel

Posted by Abigail on May 7, 2008, 6:00 am
Please log in for more thread options
_
Frank Seitz (devnull4711@web.de) wrote on VCCCLXIII September MCMXCIII in
;; Abigail wrote:
;; > _
;; > Samik R. (samik@frKKshKll.org) wrote on VCCCLXIII September MCMXCIII in
;; > :) 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?
;; >
;; > Sure.
;; >
;; > if (/_/) {
;; > print "$_ is invalid";
;; > }
;; > else {
;; > print "$_ is valid";
;; > }
;;
;; An e-mail address with _ (or ._ or _.) isn't invalid, AFAIK.


But that wasn't what he asked.

He wanted to filter out three particular email addresses.



Abigail
--
my $qr = qr/^.+?(;).+?|;Just another Perl Hacker;|;.+$/;
$qr =~ s/$qr//g;
print $qr, "\n";

Posted by Gordon Etly on May 7, 2008, 8:57 pm
Please log in for more thread options
Abigail wrote:
> _
> Frank Seitz (devnull4711@web.de) wrote on VCCCLXIII September
> ;; Abigail wrote:
> ;; > _
> ;; > Samik R. (samik@frKKshKll.org) wrote on VCCCLXIII September
> ;; > :) 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?
> ;; >
> ;; > Sure.
> ;; >
> ;; > if (/_/) {
> ;; > print "$_ is invalid";
> ;; > }
> ;; > else {
> ;; > print "$_ is valid";
> ;; > }
> ;;
> ;; An e-mail address with _ (or ._ or _.) isn't invalid, AFAIK.
>
>
> But that wasn't what he asked.
>
> He wanted to filter out three particular email addresses.

Oh please, you know as well as most everyone else those were just
samples. In any case, flagging an email as invalid for having an
underscore ( /_/ ) is plain wrong, and portraying it as a solution is
disingenuous to the OP as well as anyone who comes by this in the
archives.

--
G.Etly



Similar ThreadsPosted
Trying to catch invalid emails June 10, 2008, 12:08 am
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