[32336] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3603 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 31 14:09:26 2012

Date: Tue, 31 Jan 2012 11:09:07 -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           Tue, 31 Jan 2012     Volume: 11 Number: 3603

Today's topics:
    Re: basic hash question [OT} <nospam@lisse.NA>
    Re: basic hash question <kaz@kylheku.com>
    Re: basic hash question <tadmc@seesig.invalid>
    Re: basic hash question <jondk@FAKE.EMAIL.net>
    Re: basic hash question <kaz@kylheku.com>
    Re: basic hash question <jurgenex@hotmail.com>
    Re: basic hash question <nospam@lisse.NA>
    Re: basic hash question <nospam@lisse.NA>
    Re: basic hash question <kaz@kylheku.com>
    Re: basic hash question <nospam@lisse.NA>
    Re: job cull; Warner Brothers; try this (Tim McDaniel)
    Re: job cull; Warner Brothers; try this <cwilbur@chromatico.net>
    Re: job cull; Warner Brothers; try this <m@rtij.nl.invlalid>
    Re: Multiline regex not matching <hjp-usenet2@hjp.at>
    Re: Multiline regex not matching (Seymour J.)
    Re: Multiline regex not matching <tadmc@seesig.invalid>
    Re: Multiline regex not matching <jwkrahn@example.com>
    Re: Multiline regex not matching (Seymour J.)
    Re: ssh tunnel <nospam@lisse.NA>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 31 Jan 2012 13:27:55 +0200
From: Dr Eberhard Lisse <nospam@lisse.NA>
Subject: Re: basic hash question [OT}
Message-Id: <4F27D03B.201@lisse.NA>

Kaz,

you are right, this is what I have also observed in my 30 years of
residing in killfiles.

But then these Krauts are fairly predictable :-)-O and I couldn't care
less of checking whether they mean it or not.

el

on 2012-01-31 08:23 Kaz Kylheku said the following:
> On 2012-01-31, Jürgen Exner <jurgenex@hotmail.com> wrote:
>> Dr Eberhard Lisse <nospam@lisse.NA> wrote:
>>> Ok, next time I also full-quote.
>>
>> ***PLONK***
> 
> Uh oh, Doc, now you've done it! Jürgen is using Forte Agent too,
> so he might actually mean it.
> 
> (When you see a *plonk*, always check the headers. If they're using Google
> Groups, or if their newsreader is an e-mail program, their killfile
> is only mental, and within days, they will not be able to refrain from
> following up to one of your posts.)



------------------------------

Date: Mon, 30 Jan 2012 19:41:38 +0000 (UTC)
From: Kaz Kylheku <kaz@kylheku.com>
Subject: Re: basic hash question
Message-Id: <20120130113921.923@kylheku.com>

On 2012-01-30, Charlton Wilbur <cwilbur@chromatico.net> wrote:
>>>>>> "EL" == Eberhard Lisse <nospam@lisse.NA> writes:
>
>    EL> on 2012-01-30 11:43 Jürgen Exner said the following:
>
>     >> Whatever "it" is meant to be. "it" certainly is not Usenet
>     >> manners.  Please do not top-post. It is confusing, irritating,
>     >> and very much frowned upon.
>
>    EL> Ok, next time I also full-quote.  el
>
> You just don't seem to get it.

Oh he gets it, all right. He can get all of you to keep harping on this
triviality more predictably than robots 256 bytes of firmware.

Doc: 1, Wankers: 0.


------------------------------

Date: Mon, 30 Jan 2012 13:43:27 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: basic hash question
Message-Id: <slrnjidt63.1mj.tadmc@tadbox.sbcglobal.net>

Charlton Wilbur <cwilbur@chromatico.net> wrote:
>>>>>> "EL" == Eberhard Lisse <nospam@lisse.NA> writes:
>
>    EL> on 2012-01-30 11:43 Jürgen Exner said the following:
>
>     >> Whatever "it" is meant to be. "it" certainly is not Usenet
>     >> manners.  Please do not top-post. It is confusing, irritating,
>     >> and very much frowned upon.
>
>    EL> Ok, next time I also full-quote.  el
>
> You just don't seem to get it.


I think he does get it, but that he does not care to be socially acceptable.

His attitude is "you all conform to my way" rather than he conforming
to the way of everyone else.

In other words, Eberhard Lisse is important, and everybody else is not.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.


------------------------------

Date: Mon, 30 Jan 2012 16:07:08 -0500
From: Jon Du Kim <jondk@FAKE.EMAIL.net>
Subject: Re: basic hash question
Message-Id: <3b8fd$4f27067d$84b70406$13921@news.eurofeeds.com>

On 1/30/12 2:41 PM, Kaz Kylheku wrote:
> On 2012-01-30, Charlton Wilbur<cwilbur@chromatico.net>  wrote:
>>>>>>> "EL" == Eberhard Lisse<nospam@lisse.NA>  writes:
>>
>>     EL>  on 2012-01-30 11:43 Jürgen Exner said the following:
>>
>>      >>  Whatever "it" is meant to be. "it" certainly is not Usenet
>>      >>  manners.  Please do not top-post. It is confusing, irritating,
>>      >>  and very much frowned upon.
>>
>>     EL>  Ok, next time I also full-quote.  el
>>
>> You just don't seem to get it.
>
> Oh he gets it, all right. He can get all of you to keep harping on this
> triviality more predictably than robots 256 bytes of firmware.
>
> Doc: 1, Wankers: 0.

You seem to have a firmer understanding of reality than the rest
of these dopes. "wankers" indeed!
Nice to see another half-way normal person post around here.


------------------------------

Date: Mon, 30 Jan 2012 21:47:34 +0000 (UTC)
From: Kaz Kylheku <kaz@kylheku.com>
Subject: Re: basic hash question
Message-Id: <20120130133833.57@kylheku.com>

On 2012-01-30, Jon Du Kim <jondk@FAKE.EMAIL.net> wrote:
> On 1/30/12 2:41 PM, Kaz Kylheku wrote:
>> On 2012-01-30, Charlton Wilbur<cwilbur@chromatico.net>  wrote:
>> Doc: 1, Wankers: 0.
>
> You seem to have a firmer understanding of reality than the rest
> of these dopes. "wankers" indeed!

Basically, you cannot brow-beat someone by the use of rude commands, into
having proper manners. That makes a farce out of the concept of manners.

In Japan, it is completely uncustomary to say something if someone
has done something rude (for which is there is plenty of opportunity to screw
up, in behavior, or speech).

One interesting difference is that here in North America, we say "excuse me" to
order to ask people to make space so that we can pass through a crowd, or sit.

By contrast, those kinds of accomodations usually happen without the exchange
of words. If you were to say the equivalent of excuse me, it would be rude,
because it says, "You who do not have the sense to make space for others, I'm
asking you to move."


------------------------------

Date: Mon, 30 Jan 2012 17:21:17 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: basic hash question
Message-Id: <lfgei7dgutataar7j1n88d7fjpd3i3jb8c@4ax.com>

Dr Eberhard Lisse <nospam@lisse.NA> wrote:
>Ok, next time I also full-quote.

***PLONK***

jue

>on 2012-01-30 11:43 Jürgen Exner said the following:
>> Dr Eberhard Lisse <nospam@lisse.NA> wrote:
>>> thank you very much, I think am getting the gist of it :-)-O
>> 
>> Whatever "it" is meant to be. "it" certainly is not Usenet manners.
>> Please do not top-post. It is confusing, irritating, and very much
>> frowned upon.
>> 
>> jue
>> 
>>> on 2012-01-27 12:57 Dr Eberhard Lisse said the following:
>>>> Jim,
>>>>
>>>> This oes what I want, and I'll use the weekend to try and
>>>> understand it :-)-O
>>>>
>>>> Thank you very much.
>>>>
>>>> el


------------------------------

Date: Tue, 31 Jan 2012 06:51:34 +0200
From: Dr Eberhard W Lisse <nospam@lisse.NA>
Subject: Re: basic hash question
Message-Id: <4F277356.4000404@lisse.NA>

What Excuse?

Come on Feed me :-)-O

el


On 2012-01-30 19:45 , Charlton Wilbur wrote:
>>>>>> "EL" == Eberhard Lisse <nospam@lisse.NA> writes:
> 
>     EL> on 2012-01-30 11:43 Jürgen Exner said the following:
> 
>     >> Whatever "it" is meant to be. "it" certainly is not Usenet
>     >> manners.  Please do not top-post. It is confusing, irritating,
>     >> and very much frowned upon.
> 
>     EL> Ok, next time I also full-quote.  el
> 
> You just don't seem to get it.
> 
> You are here asking for help.  It would behoove you to adhere to the
> conventions of the forum in which you are asking for help.  Not doing
> so, and being such a pill about not doing so that the most knowledgeable
> people get irritated enough to killfile you, means you are cutting
> yourself off from the very help you seek.
> 
> And that "I can't, I'm using Emacs" excuse?  Hey!  So am I!  And yet
> somehow I manage not to top-post.
> 
> Charlton
> 
> 
> 
> 
> 


-- 
If you want to email me, replace nospam with el


------------------------------

Date: Tue, 31 Jan 2012 06:53:19 +0200
From: Dr Eberhard W Lisse <nospam@lisse.NA>
Subject: Re: basic hash question
Message-Id: <4F2773BF.4070707@lisse.NA>

You are welcome.

el

On 2012-01-30 23:07 , Jon Du Kim wrote:
> On 1/30/12 2:41 PM, Kaz Kylheku wrote:
>> On 2012-01-30, Charlton Wilbur<cwilbur@chromatico.net>  wrote:
>>>>>>>> "EL" == Eberhard Lisse<nospam@lisse.NA>  writes:
>>>
>>>     EL>  on 2012-01-30 11:43 Jürgen Exner said the following:
>>>
>>>      >>  Whatever "it" is meant to be. "it" certainly is not Usenet
>>>      >>  manners.  Please do not top-post. It is confusing, irritating,
>>>      >>  and very much frowned upon.
>>>
>>>     EL>  Ok, next time I also full-quote.  el
>>>
>>> You just don't seem to get it.
>>
>> Oh he gets it, all right. He can get all of you to keep harping on this
>> triviality more predictably than robots 256 bytes of firmware.
>>
>> Doc: 1, Wankers: 0.
> 
> You seem to have a firmer understanding of reality than the rest
> of these dopes. "wankers" indeed!
> Nice to see another half-way normal person post around here.


-- 
If you want to email me, replace nospam with el


------------------------------

Date: Tue, 31 Jan 2012 06:23:14 +0000 (UTC)
From: Kaz Kylheku <kaz@kylheku.com>
Subject: Re: basic hash question
Message-Id: <20120130222117.385@kylheku.com>

On 2012-01-31, Jürgen Exner <jurgenex@hotmail.com> wrote:
> Dr Eberhard Lisse <nospam@lisse.NA> wrote:
>>Ok, next time I also full-quote.
>
> ***PLONK***

Uh oh, Doc, now you've done it! Jürgen is using Forte Agent too,
so he might actually mean it.

(When you see a *plonk*, always check the headers. If they're using Google
Groups, or if their newsreader is an e-mail program, their killfile
is only mental, and within days, they will not be able to refrain from
following up to one of your posts.)


------------------------------

Date: Tue, 31 Jan 2012 13:21:08 +0200
From: Dr Eberhard Lisse <nospam@lisse.NA>
Subject: Re: basic hash question
Message-Id: <4F27CEA4.3020405@lisse.NA>

I think you have no clue whatsoever what is socially acceptable.
The arrogance displayed in several of your replies to (me and) others
asking questions here speaks for itself.

Which is why I suggested earlier you should go out more.

Or, you can speak to Isak N Jakobsen.

el


on 2012-01-30 21:43 Tad McClellan said the following:
> Charlton Wilbur <cwilbur@chromatico.net> wrote:
>>>>>>> "EL" == Eberhard Lisse <nospam@lisse.NA> writes:
>>
>>    EL> on 2012-01-30 11:43 Jürgen Exner said the following:
>>
>>     >> Whatever "it" is meant to be. "it" certainly is not Usenet
>>     >> manners.  Please do not top-post. It is confusing, irritating,
>>     >> and very much frowned upon.
>>
>>    EL> Ok, next time I also full-quote.  el
>>
>> You just don't seem to get it.
> 
> 
> I think he does get it, but that he does not care to be socially acceptable.
> 
> His attitude is "you all conform to my way" rather than he conforming
> to the way of everyone else.
> 
> In other words, Eberhard Lisse is important, and everybody else is not.
> 
> 



------------------------------

Date: Mon, 30 Jan 2012 19:43:36 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: job cull; Warner Brothers; try this
Message-Id: <jg6rt8$14t$1@reader1.panix.com>

In article <ge5jv8-rus.ln1@news.rtij.nl>,
Martijn Lievaart  <m@rtij.nl.invlalid> wrote:
>On Fri, 27 Jan 2012 22:02:04 +0000, Rainer Weikusat wrote:
>
>> The people who posted the challenge
>> presumably weren't interested in 'Charton Wilbers' 'rip free stuff off
>> the internet' skills. Actually, I doubt anyone else was, either.
>
>I *expect* an applicant to be able to reuse code where ever possible. I 
>would give Charlton extra points for his solution.

And then ask the candidate to implement it from scratch, or give them
another problem for which there is no CPAN module.  'Cause it's nice
to know that they'll be sensible about getting fast solutions where
possible, but you do want to know their coding skills.

-- 
Tim McDaniel, tmcd@panix.com


------------------------------

Date: Mon, 30 Jan 2012 14:24:52 -0500
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: job cull; Warner Brothers; try this
Message-Id: <87fwexro1n.fsf@new.chromatico.net>

>>>>> "RW" == Rainer Weikusat <rweikusat@mssgmbh.com> writes:

    RW> This depends on the challenge: If it was 'design and implemented
    RW> a programming language at least capable of calculating the some
    RW> of 1 and 1 and printing it in response to some input', your
    RW> example above is not 'the one line solution' but just an attempt
    RW> to pass off stuff others wrote as your own. If it was 'write
    RW> code which prints the sum of 1 + 1' the example is a possible
    RW> solution. The people who posted the challenge presumably weren't
    RW> interested in 'Charton Wilbers' 'rip free stuff off the
    RW> internet' skills. Actually, I doubt anyone else was, either.

The person who posted the challenge here wanted a solution in three
lines, which I delivered.  And the module is explicitly called out in
the one-liner: if I said, "According to the Encylopedia Britannica" in a
thread, would you accuse me of trying to pass off that work as my own?

Finally, if you're going to attempt to insult me by putting my name in
scare quotes, the very least you could do would be to spell it
correctly, 'Reiner Wiekusat.'

Charlton



-- 
Charlton Wilbur
cwilbur@chromatico.net


------------------------------

Date: Tue, 31 Jan 2012 12:55:53 +0100
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: job cull; Warner Brothers; try this
Message-Id: <9f1lv8-4dl.ln1@news.rtij.nl>

On Mon, 30 Jan 2012 19:43:36 +0000, Tim McDaniel wrote:

> In article <ge5jv8-rus.ln1@news.rtij.nl>, Martijn Lievaart 
> <m@rtij.nl.invlalid> wrote:

>> I *expect* an applicant to be able to reuse code where ever possible. I
>> would give Charlton extra points for his solution.
> 
> And then ask the candidate to implement it from scratch, or give them
> another problem for which there is no CPAN module.  'Cause it's nice to
> know that they'll be sensible about getting fast solutions where
> possible, but you do want to know their coding skills.

Possibly, probably. But note that coding skills take many forms. Do they 
know basic algorithms and can they apply them to real world problems? Can 
they code in a team? Can they write maintainable code? 

M4


------------------------------

Date: Mon, 30 Jan 2012 21:49:19 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Multiline regex not matching
Message-Id: <slrnjie0if.dku.hjp-usenet2@hrunkner.hjp.at>

On 2012-01-30 17:38, Shmuel Metz <spamtrap@library.lspace.org.invalid> wrote:
> I'm having a problem doing a regex match on a multi-line string. The
> actual program[1] is rather large, but I've come up with a test case
> that demonstrates the problem. I'm running on OS/2, which uses CRLF as
> a line end.
>
>  #y $FWS               = qr/ (?:[ \t]*\15?\12)? [ \t]+ /mx;
>  my $FWS               = qr/ (?:[ \t]*\15?\n)? [ \t]+ /mx;
>  my $CFWS              = qr/
>                             (?: (?:$FWS+ $commentPat)+ $FWS?) |
>                             $FWS
>                            /mx;
>  my $testheader = <<'EOF';
>  from localhost (localhost [127.0.0.1])
>  by lincoln-at-leros.patriot.net (Postfix) with ESMTP id 12BBE55E73
>  for <marianne@patriot.net>; Fri, 27 Jan 2012 09:23:59 -0500 (EST)
>  EOF

Since the "EOF" is inserted by one space I guess that you indented the
whole script by one space before posting. If this is true, there is no
space before "by lincoln-at-leros.patriot.net ..."

>     if ($testheader =~ /(\) $CFWS BY)/imx) {

so it doesn't match the regexp.

[...]
> If you replace the regex with the one that's commented out, the
> results are the same. I dumped $header in hex and the lines are
> separated by LF ('0A'X) rather than CRLF ('0D0A'X), which is normal
> for Perl. Does anybody see what I'm doing wrong? Thanks.

It does match if leading whitespace is inserted, so it seems that your
regexp is correct, but your data isn't.

	hp


-- 
   _  | Peter J. Holzer    | Deprecating human carelessness and
|_|_) | Sysadmin WSR       | ignorance has no successful track record.
| |   | hjp@hjp.at         | 
__/   | http://www.hjp.at/ |  -- Bill Code on asrg@irtf.org


------------------------------

Date: Mon, 30 Jan 2012 20:31:42 -0500
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Re: Multiline regex not matching
Message-Id: <4f27447e$2$fuzhry+tra$mr2ice@news.patriot.net>

In <slrnjie0if.dku.hjp-usenet2@hrunkner.hjp.at>, on 01/30/2012
   at 09:49 PM, "Peter J. Holzer" <hjp-usenet2@hjp.at> said:

>Since the "EOF" is inserted by one space I guess that you indented
>the whole script by one space before posting.

Yes.

>If this is true, there is no
>space before "by lincoln-at-leros.patriot.net ..."

>If this is true, there is no
>space before "by lincoln-at-leros.patriot.net ..."

Ouch! Another case of seeing what I expect instead of what's there.

>It does match if leading whitespace is inserted, so it seems that
>your regexp is correct, but your data isn't.

Yes, I should have indented the continuation line..

I'm making progress, but still have some matches that aren't doing
what I expect.

With $testheader= from localhost (localhost [127.0.0.1])
  by lincoln-at-leros.patriot.net (Postfix) with ESMTP id 12BBE55E73
  for <marianne@patriot.net>; Fri, 27 Jan 2012 09:23:59 -0500 (EST):
and

 my $FWS               = qr/ (?:[ \t]*\15?\n)? [ \t]+ /mx;
 my $CFWS              = qr/
                            (?: (?:$FWS+ $commentPat)+ $FWS?) |
                            $FWS
                           /mx;
 my $RecForPat         = qr/$CFWS FOR $FWS (?: $RecPathPat |
$MailboxPat)/imx;


The test $testheader =~ /(\) $RecByPat? $RecWithPat? $RecIdPat?
$RecForPat?) /imx matches up to 12BBE55E73 but a match for just
$testheader =~ /((?<FOR>$RecForPat))/imx matches the for clause and
sets the capture buffer.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



------------------------------

Date: Mon, 30 Jan 2012 22:07:20 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Multiline regex not matching
Message-Id: <slrnjieqmt.2rk.tadmc@tadbox.sbcglobal.net>

Shmuel Metz <spamtrap@library.lspace.org.invalid> wrote:
> In <slrnjie0if.dku.hjp-usenet2@hrunkner.hjp.at>, on 01/30/2012
>    at 09:49 PM, "Peter J. Holzer" <hjp-usenet2@hjp.at> said:
>
>>Since the "EOF" is inserted by one space I guess that you indented
>>the whole script by one space before posting.
>
> Yes.
>
>>If this is true, there is no
>>space before "by lincoln-at-leros.patriot.net ..."
>
>>If this is true, there is no
>>space before "by lincoln-at-leros.patriot.net ..."
>
> Ouch! Another case of seeing what I expect instead of what's there.
>
>>It does match if leading whitespace is inserted, so it seems that
>>your regexp is correct, but your data isn't.
>
> Yes, I should have indented the continuation line..


As we have seen, it is critically important for us to see BOTH the
string to be matched against AND the pattern (regex) that is to be
matched if we hope to figure out why it is not behaving as expected.


> I'm making progress, but still have some matches that aren't doing
> what I expect.
>
> With $testheader= from localhost (localhost [127.0.0.1])
>   by lincoln-at-leros.patriot.net (Postfix) with ESMTP id 12BBE55E73
>   for <marianne@patriot.net>; Fri, 27 Jan 2012 09:23:59 -0500 (EST):


Nobody knows what string is in $testheader (because it is not loaded
up in Real Perl Code) so we cannot help with matching it...


You should make an unambigous representation of your string:

    $testheader = "from localhost (localhost [127.0.0.1])\n"
                . "by lincoln-at-leros.patriot.net (Postfix) "
                . "with ESMTP id 12BBE55E73\n"
                . "for <marianne@patriot.net>; Fri, 27 Jan 2012 "
                . 09:23:59 -0500 (EST):\n";

-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.


------------------------------

Date: Tue, 31 Jan 2012 00:34:17 -0800
From: "John W. Krahn" <jwkrahn@example.com>
Subject: Re: Multiline regex not matching
Message-Id: <eINVq.2146$j%3.1031@newsfe04.iad>

Shmuel (Seymour J.) Metz wrote:
>
> I'm having a problem doing a regex match on a multi-line string. The
> actual program[1] is rather large, but I've come up with a test case
> that demonstrates the problem. I'm running on OS/2, which uses CRLF as
> a line end.
>
>   #y $FWS               = qr/ (?:[ \t]*\15?\12)? [ \t]+ /mx;
>   my $FWS               = qr/ (?:[ \t]*\15?\n)? [ \t]+ /mx;
>   my $CFWS              = qr/
>                              (?: (?:$FWS+ $commentPat)+ $FWS?) |
>                              $FWS
>                             /mx;
>   my $testheader =<<'EOF';
>   from localhost (localhost [127.0.0.1])
>   by lincoln-at-leros.patriot.net (Postfix) with ESMTP id 12BBE55E73
>   for<marianne@patriot.net>; Fri, 27 Jan 2012 09:23:59 -0500 (EST)
>   EOF
>      if ($testheader =~ /(\) $CFWS BY)/imx) {

The /m option in a regular expression affects the behavior the ^ and $ 
anchors, but you are not using either of those anchors so the use of /m 
is superfluous.



John
-- 
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein


------------------------------

Date: Tue, 31 Jan 2012 12:49:01 -0500
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Re: Multiline regex not matching
Message-Id: <4f28298d$9$fuzhry+tra$mr2ice@news.patriot.net>

In <slrnjieqmt.2rk.tadmc@tadbox.sbcglobal.net>, on 01/30/2012
   at 10:07 PM, Tad McClellan <tadmc@seesig.invalid> said:

>Nobody knows what string is in $testheader (because it is not loaded
>up in Real Perl Code) so we cannot help with matching it...

Okay, this time I'll provide a complete program instead of snippets.
Where I'm stuck is in the discrepancy between the first and second
test of $testheader

[1] /(\) $RecByPat? $RecWithPat? $RecIdPat? $RecForPat?) /imx

[2] /((?<FOR>$RecForPat))/imx

#!/usr/bin/perl -W

use 5.010;
use Data::Dumper;
use Regexp::Common qw /net URI/;
use Socket;
use strict;
my $decOctetPat    = qr/ \d          |
                         [1-9] \d    |
                         1 \d \d     |
                         2 [0-4] \d  |
                         25 [0-5]
                       /x;
my $IPv4addressPat  = qr/ (?:$decOctetPat\.){3} $decOctetPat /x;
my $IPv6h16        = qr/[[:xdigit:]]{1,4}/;
my $IPv6ls32       = qr/ $IPv6h16 \: $IPv6h16 | $IPv4addressPat /x;
my $IPv6AddrPat    = qr/ (?: (?: $IPv6h16 \: ){6}                                           $IPv6ls32 ) |
                         (?: \:\: (?: $IPv6h16 \: ){5}                                      $IPv6ls32 ) |
                         (?: (?: $IPv6h16 )?                      \:\: (?: $IPv6h16 \: ){4} $IPv6ls32 ) |
                         (?: (?: $IPv6h16 \: $IPv6h16 )?          \:\: (?: $IPv6h16 \: ){3} $IPv6ls32 ) |
                         (?: (?: (?: $IPv6h16 \: ){2} $IPv6h16 )? \:\: (?: $IPv6h16 \: ){2} $IPv6ls32 ) |
                         (?: (?: (?: $IPv6h16 \: ){3} $IPv6h16 )? \:\:     $IPv6h16 \:      $IPv6ls32 ) |
                         (?: (?: (?: $IPv6h16 \: ){5} $IPv6h16 )? \:\:                      $IPv6ls32 ) |
                         (?: (?: (?: $IPv6h16 \: ){6} $IPv6h16 )? \:\:                                    )
                       /x;
my $domainPat      = qr/[[:alnum:]]+
                        [[:alnum:]-]*
                        (?:\. [[:alnum:]]+ [[:alnum:]-]*)*
                       /x;
my $addressLiteralPat = qr/\[
                           (?:$IPv4addressPat |
                              $IPv6AddrPat
                           )
                           \]
                          /x;
my $atextPat          = qr"(?:[\w!#\$%&'*+/=?^`{|}~-]+)";
#y $FWS               = qr/ (?:[ \t]*\15?\12)? [ \t]+ /mx;
my $FWS               = qr/ (?:[ \t]*\15?\n)? [ \t]+ /mx;
my $atomPat           = qr/\s* $atextPat+ \s*/x;
my $ctext             = '[\x21-\x27\x2A-\x5B\x5D-\x7E]';
my $dotStringPat      = qr/$atextPat+ (?:\. $atextPat)*/x;
my $LinkPat           = qr/TCP | $atomPat/xi;
my $dtextPat          = '[\x21-\x50\x54-\x7E]';
my $idLeftPat         = qr/$dotStringPat/;
my $noFoldLiteralPat  = qr/\[ $dtextPat* \]/x;
my $idRightPat        = qr/$dotStringPat | $noFoldLiteralPat/x;
my $msgIdPat          = qr/\s* \< $idLeftPat \@ $idRightPat \> \s*/x;
my $quotedPairPat     = qr/ \\ [\x20-\x7E] /x;
my $qtextPat          = '[\x20-\x21\x23-\x5B\x5d-\x7E]';
my $QcontentPat       = qr/$qtextPat | $quotedPairPat/x;
my $QuotedStringPat   = qr/"$QcontentPat*"/;
my $commentPat        =qr/
                           \(
                           (?:$FWS?
                              (?:$ctext | $quotedPairPat    | (?R))
                           )*
                           $FWS?
                           \)
                         /x;
my $CFWS              = qr/
                           (?: (?:$FWS+ $commentPat)+ $FWS?) |
                           $FWS
                          /mx;
my $localPartPat      = qr/$dotStringPat | $QuotedStringPat/x;
my $MailboxPat        = qr/(?<LOCAL_PART>$localPartPat) \@ (?<DOMAIN>$domainPat | $addressLiteralPat)/x;
my $RecPathPat        = qr/
                           \<
                           (?:\@ $domainPat (?:, \@ $domainPat)* :)?
                           $MailboxPat
                           \>
                          /x;
my $RecByPat          = qr!$CFWS
                           BY
                           $FWS
                           (?<BY1>
                             (?:$domainPat                   |
                                \[ $RE{net}{IPv4} \]
                             )
                           )
                           (?:
                              \s*
                              \(
                                (?<BY2>[\s\w\./-]+)
                              \)
                           )?
                          !mxi;
my $RecForPat         = qr/$CFWS FOR $FWS (?: $RecPathPat | $MailboxPat)/imx;
my $RecIdPat          = qr/$CFWS ID $FWS (?:$atomPat | $msgIdPat)/imx;
my $RecViaPat         = qr/$CFWS VIA $FWS $LinkPat/imx;
my $RecWithMS         = qr/Microsoft \s+ (?:ESMTP|SMTP) (?:\s+ Server | SVC\(\d+(?:\.\d+)*\))/ix;
my $RecWithPat        = qr/$CFWS
                           WITH $FWS
                           (?:
                             (?:ESMTP|SMTP)                          |
                             $RecWithMS                              |
                             NNFMP                                   # Yahoo
                           )
                          /imx;

my $RecOptInfo        = qr/
                           (?<VIA>$RecViaPat)?
                           (?<WITH>$RecWithPat)?
                           (?:$RecIdPat)?
                           (?<FOR>$RecForPat)?
                          /imx;

my $testheader = <<'EOF';
from localhost (localhost [127.0.0.1])
  by lincoln-at-leros.patriot.net (Postfix) with ESMTP id 12BBE55E73
  for <marianne@patriot.net>; Fri, 27 Jan 2012 09:23:59 -0500 (EST)
EOF
   msg("\n\$testheader= $testheader\n");
   msg("\n\$testheader= ".unpack('H*',$testheader)."\n");
   if ($testheader =~ /(\) $RecByPat? $RecWithPat? $RecIdPat? $RecForPat?) /imx) {
     print STDERR "\n\$testheader matched FWS\n";
     print STDERR "\n";
     print STDERR "\n\$PREMATCH =$`\n";
     print STDERR "\n\$POSTMATCH=$'\n";
     msg("\nDumper(\%+):\n");
     msg(Dumper(%+),"\n");
     msg("\nDumper(\%-):\n");
     msg(Dumper(%-),"\n");
     foreach (sort keys %+) {
       print STDERR "\$+{$_}=$+{$_}\n";
     }
     print STDERR "\n";
   } else {
     print STDERR "\n\$testheader did not match FWS\n";
   }
#  if ($testheader =~ /(?<WITH>$RecWithPat)/im) {
#  if ($testheader =~ /$RecOptInfo?/) {
#  if ($testheader =~ /($CFWS FOR $FWS (?: $RecPathPat | $MailboxPat))/imx) {
   if ($testheader =~ /((?<FOR>$RecForPat))/imx) {
     print STDERR "\n\$testheader matched\n";
     msg("\nDumper(\%+):\n");
     msg(Dumper(%+),"\n");
     msg("\nDumper(\%-):\n");
     msg(Dumper(%-),"\n");
     foreach (sort keys %+) {
       print STDERR "\$+{$_}=$+{$_}\n";
     }
     print STDERR "\n";
   } else {
     print STDERR "\n\$testheader did not match\n";
   }

sub msg {
   print STDERR @_;
}

1;
__END__

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



------------------------------

Date: Tue, 31 Jan 2012 13:30:49 +0200
From: Dr Eberhard Lisse <nospam@lisse.NA>
Subject: Re: ssh tunnel
Message-Id: <4F27D0E9.9090105@lisse.NA>

If multiple morons whine that not necessarily means anything other than
that they are morons.

el

on 2012-01-30 19:25 Tim McDaniel said the following:
> In article <4F2460EE.2090006@lisse.NA>,
>> We are now hoever getting well off topic,
> 
> Meta-discussion is related to the topic.
> 
>> and though I enjoy  a
>> good flame as the next one I wasn't really trolling.
> 
> When multiple people tell you about group customs and explain why
> they're practical, and you loudly refuse to follow and denigrate the
> reasons: yes, you are indeed trolling.  Luckily, my news reader has a
> "killfile" that can filter by sender.
> 



------------------------------

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:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 V11 Issue 3603
***************************************


home help back first fref pref prev next nref lref last post