Multiline regex not matching



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@xxxxxxxxxxx>; Fri, 27 Jan 2012 09:23:59 -0500 (EST)
EOF
if ($testheader =~ /(\) $CFWS BY)/imx) {
print STDERR "\n\$testheader matched FWS\n";
print STDERR "\n";
print STDERR "\n\$PREMATCH =$`\n";
print STDERR "\n\$POSTMATCH=$'\n";
foreach (sort keys %+) {
print STDERR "\$+{$_}=$+{$_}\n";
}
print STDERR "\n";
} else {
print STDERR "\n\$testheader did not match FWS\n";
}

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.

[1] Available offline on request; it's too big to post here.

--
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@xxxxxxxxxxxxxxxxxx

.