[27067] in Perl-Users-Digest
Perl-Users Digest, Issue: 8967 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 17 11:05:44 2006
Date: Fri, 17 Feb 2006 08:05:04 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 17 Feb 2006 Volume: 10 Number: 8967
Today's topics:
Re: Merging sparse arrays <samwyse@gmail.com>
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi <samwyse@gmail.com>
Puzzled over rgexp <whoever@whereever.com>
Re: Puzzled over rgexp <thundergnat@hotmail.com>
Re: Puzzled over rgexp <whoever@whereever.com>
Re: Puzzled over rgexp <noreply@gunnar.cc>
Re: Puzzled over rgexp <whoever@whereever.com>
Re: Puzzled over rgexp <noreply@gunnar.cc>
Re: Puzzled over rgexp <1usa@llenroc.ude.invalid>
Re: The inverse problem: generate all instances of a re <rvtol+news@isolution.nl>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 17 Feb 2006 12:04:04 GMT
From: Samwyse <samwyse@gmail.com>
Subject: Re: Merging sparse arrays
Message-Id: <UYiJf.8867$rL5.5223@newssvr27.news.prodigy.net>
Tad McClellan wrote:
> Samwyse <samwyse@gmail.com> wrote:
>>In this case, the data is coming from a CSV file, so undefined values
>>are represented by empty strings,
>
> Then Abigail's note would apply.
>
>>and zeros aren't a concern.
>
> Yes they are:
>
> "foo","0","bar"
>
> Then Abigail's note would again apply for the 2nd field there.
Sorry, I meant to say that zeros aren't a concern for my particular
dataset, as none of the fields contain numeric data, zero (even quoted)
is not a valid value, and I've previously verified the validity of the
data that is present.
------------------------------
Date: Fri, 17 Feb 2006 11:54:12 GMT
From: Samwyse <samwyse@gmail.com>
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.5 $)
Message-Id: <EPiJf.8866$rL5.8397@newssvr27.news.prodigy.net>
tadmc@augustmail.com wrote:
[a really big post with only small problems]
s/Outline/Executive Summary/;
s/Count to ten after composing and/After composing, count to ten again/;
------------------------------
Date: Fri, 17 Feb 2006 14:05:10 -0000
From: "IanW" <whoever@whereever.com>
Subject: Puzzled over rgexp
Message-Id: <dt4l6n$hu2$1@blackmamba.itd.rl.ac.uk>
Can anyone tell me why the following doesn't return "Not standards
compliant"?
my $em = ',someone@somewhere.com'; # note the comma in fornt of the email
address
if ($em =~
/^(?!\.)[!\#\$%&'*+-\/=?^_`{|}~.a-zA-Z0-9]+(?<!\.)\@(?!\.)[a-zA-Z0-9-.]+$/)
{
print "Standards compliant";
}
else {
print "Not standards compliant";
}
If you put a '.' or ':' or ';' etc in front of the address it comes back
with not compliant but when it's a comma it comes back as compliant. Is this
a bug or is the fault in my code?
Thanks
Ian
------------------------------
Date: Fri, 17 Feb 2006 09:35:17 -0500
From: thundergnat <thundergnat@hotmail.com>
Subject: Re: Puzzled over rgexp
Message-Id: <hdadnZKkVO63QmjenZ2dnUVZ_tSdnZ2d@rcn.net>
IanW wrote:
> Can anyone tell me why the following doesn't return "Not standards
> compliant"?
>
> my $em = ',someone@somewhere.com'; # note the comma in fornt of the email
> address
> if ($em =~
> /^(?!\.)[!\#\$%&'*+-\/=?^_`{|}~.a-zA-Z0-9]+(?<!\.)\@(?!\.)[a-zA-Z0-9-.]+$/)
> {
> print "Standards compliant";
> }
> else {
> print "Not standards compliant";
> }
>
> If you put a '.' or ':' or ';' etc in front of the address it comes back
> with not compliant but when it's a comma it comes back as compliant. Is this
> a bug or is the fault in my code?
>
> Thanks
> Ian
>
>
Hyphens are significant inside character classes.
Move the hyphen to the end or beginning of the character class or escape it.
You are including the range [+-\/] in your search which equates to +,-./
------------------------------
Date: Fri, 17 Feb 2006 14:47:07 -0000
From: "IanW" <whoever@whereever.com>
Subject: Re: Puzzled over rgexp
Message-Id: <dt4nlb$itc$1@blackmamba.itd.rl.ac.uk>
"thundergnat" <thundergnat@hotmail.com> wrote in message
news:hdadnZKkVO63QmjenZ2dnUVZ_tSdnZ2d@rcn.net...
> IanW wrote:
>> /^(?!\.)[!\#\$%&'*+-\/=?^_`{|}~.a-zA-Z0-9]+(?<!\.)\@(?!\.)[a-zA-Z0-9-.]+$/)
> Hyphens are significant inside character classes.
I wondered about that except that when I tested each character within the
square brackets to see if it came back with "standards compliant", it did so
when I put a '-' into the local part of the email, which made me think it
hadn't treated it as a special charater on it's own. Like with the * which
would normally mean 0 or more apostrophes but in this case a * comes back as
standards compliant too.. I may not be explaining this very well! Is there
anything else in this context I should escape that I'm not doing?
> Move the hyphen to the end or beginning of the character class or escape
> it.
however, that works nicely.. thanks :-)
> You are including the range [+-\/] in your search which equates to +,-./
how coincidental is that? That is, it's not a V, it's an escaped forward
slash!
Regards
Ian
------------------------------
Date: Fri, 17 Feb 2006 16:02:41 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Puzzled over rgexp
Message-Id: <45m70eF7d051U1@individual.net>
IanW wrote:
> Can anyone tell me why the following doesn't return "Not standards
> compliant"?
>
> my $em = ',someone@somewhere.com'; # note the comma in fornt of the email
> address
> if ($em =~
> /^(?!\.)[!\#\$%&'*+-\/=?^_`{|}~.a-zA-Z0-9]+(?<!\.)\@(?!\.)[a-zA-Z0-9-.]+$/)
--------------------^^^^
Those characters are interpreted as a range ( \053-\057 ), which happens
to include comma ( \054 ). Put the '-' at the beginning or end of the
character class.
> {
> print "Standards compliant";
> }
> else {
> print "Not standards compliant";
> }
Btw, which standard are you referring to?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 17 Feb 2006 15:09:18 -0000
From: "IanW" <whoever@whereever.com>
Subject: Re: Puzzled over rgexp
Message-Id: <dt4ouv$je7$1@blackmamba.itd.rl.ac.uk>
"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
news:45m70eF7d051U1@individual.net...
> IanW wrote:
>> Can anyone tell me why the following doesn't return "Not standards
>> compliant"?
>>
>> my $em = ',someone@somewhere.com'; # note the comma in fornt of the email
>> address
>> if ($em =~
>> /^(?!\.)[!\#\$%&'*+-\/=?^_`{|}~.a-zA-Z0-9]+(?<!\.)\@(?!\.)[a-zA-Z0-9-.]+$/)
> --------------------^^^^
>
> Those characters are interpreted as a range ( \053-\057 ), which happens
> to include comma ( \054 ). Put the '-' at the beginning or end of the
> character class.
I see, thanks
>> {
>> print "Standards compliant";
>> }
>> else {
>> print "Not standards compliant";
>> }
>
> Btw, which standard are you referring to?
RFC2822, according to wikipedia
Ian
------------------------------
Date: Fri, 17 Feb 2006 16:27:10 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Puzzled over rgexp
Message-Id: <45m8ebF7e4o2U1@individual.net>
IanW wrote:
> Gunnar Hjalmarsson wrote:
>>Btw, which standard are you referring to?
>
> RFC2822, according to wikipedia
There are certainly RFC 2822 compliant addresses that won't match your
regex. Quoted strings and domain literals come to mind. There are
probably others.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 17 Feb 2006 15:34:38 +0000 (UTC)
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Puzzled over rgexp
Message-Id: <Xns976D6B9844FD4asu1cornelledu@132.236.56.8>
"IanW" <whoever@whereever.com> wrote in
news:dt4ouv$je7$1@blackmamba.itd.rl.ac.uk:
>
> "Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
> news:45m70eF7d051U1@individual.net...
>> IanW wrote:
>>> Can anyone tell me why the following doesn't return "Not standards
>>> compliant"?
>>>
>>> my $em = ',someone@somewhere.com'; # note the comma in fornt of the
>>> email address
>>> if ($em =~
>>> /^(?!\.)[!\#\$%&'*+-\/=?^_`{|}~.a-zA-Z0-9]+(?<!\.)\@(?!\.)[a-zA-Z0-9-
>>> .]+$/)
>> --------------------^^^^
...
>>> {
>>> print "Standards compliant";
>>> }
>>> else {
>>> print "Not standards compliant";
>>> }
>>
>> Btw, which standard are you referring to?
>
> RFC2822, according to wikipedia
I have not examined your tried your code (or whatever you lifted from
Wikipedia), but knowing what Email::Address does, I doubt that the one-
liner above can be used to discern whether an email address is RFC2822
compliant.
You may choose to educate yourself by reading:
http://search.cpan.org/src/CWEST/Email-Address-1.80/lib/Email/Address.pm
as well as the Frequently Asked Questions list (which you should have
done before posting here):
perldoc -q "How do I check a valid mail address?"
Sinan
------------------------------
Date: Fri, 17 Feb 2006 12:34:25 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: The inverse problem: generate all instances of a regexp
Message-Id: <dt4g1f.ng.1@news.isolution.nl>
Andrei Alexandrescu (See Website For Email) schreef:
> I wonder how this could be done elegantly. Given a regular expression
> $re, write a function Generate($) that returns a list of all possible
> strings that could match $re.
http://search.cpan.org/~bowmanbs/Regexp-Genex/lib/Regexp/Genex.pm
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 8967
***************************************