Re: Multiline regex not matching

Shmuel Metz <spamtrap@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
In <slrnjie0if.dku.hjp-usenet2@xxxxxxxxxxxxxxx>, on 01/30/2012
at 09:49 PM, "Peter J. Holzer" <hjp-usenet2@xxxxxx> said:

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 ..."

If this is true, there is no
space before "by ..."

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 [])
by (Postfix) with ESMTP id 12BBE55E73
for <marianne@xxxxxxxxxxx>; 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 [])\n"
. "by (Postfix) "
. "with ESMTP id 12BBE55E73\n"
. "for <marianne@xxxxxxxxxxx>; 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.