New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
qr/$/m ignores m when result is used #5722
Comments
From nagler@jump.bivio.comCreated by nagler@bivio.bizqr/bla$/m doesn't work when assigned to a var and reused. #!perl -w bad2 is the workaround which I'm using right now. Perl Info
|
From @vanstynnagler@jump.bivio.com wrote: Attached patch is enough to fix your actual example of qr/^abc$/m, For 5.9 I have plans to rework substantial parts of this area of Given that this fixes only a part of the problem and is decidedly Hugo Inline Patch--- regexec.c.old Wed Jul 10 22:17:07 2002
+++ regexec.c Sun Jul 14 19:19:09 2002
@@ -547,11 +547,13 @@
else if (prog->reganch & ROPT_CANY_SEEN)
s = fbm_instr((U8*)(s + start_shift),
(U8*)(strend - end_shift),
- check, PL_multiline ? FBMrf_MULTILINE : 0);
+ check, (PL_multiline || (prog->reganch & ROPT_ANCH_MBOL))
+ ? FBMrf_MULTILINE : 0);
else
s = fbm_instr(HOP3(s, start_shift, strend),
HOP3(strend, -end_shift, strbeg),
- check, PL_multiline ? FBMrf_MULTILINE : 0);
+ check, (PL_multiline || (prog->reganch & ROPT_ANCH_MBOL))
+ ? FBMrf_MULTILINE : 0);
/* Update the count-of-usability, remove useless subpatterns,
unshift s. */
--- t/op/pat.t.old Mon Jul 1 15:46:10 2002
+++ t/op/pat.t Sun Jul 14 19:47:30 2002
@@ -6,7 +6,7 @@
$| = 1;
-print "1..922\n";
+print "1..931\n";
BEGIN {
chdir 't' if -d 't';
@@ -2901,4 +2901,22 @@
}
}
-$test = 923;
+{
+ print "# [ID 20020713.007] qr/\$/m ignores m when used\n";
+ $test = 923;
+ my $re_both = qr{^abc$}m;
+ my $re_head = qr{^abc}m;
+ my $re_tail = qr{abc$}m;
+ # current fix still leaves MEOL without MBOL incorrectly treated as SEOL
+ my %todo = map +($_ => 1), qw/ 925 928 /;
+ for ("abc\ndef\n", "xyz\nabc\ndef\n", "xyz\nabc\n") {
+ for my $re ($re_both, $re_head, $re_tail) {
+ print /$re/ ? "ok $test\n" : $todo{$test}
+ ? "not ok $test\t# TODO: MEOL treated as SEOL in fbm_instr()\n"
+ : "not ok $test\n";
+ ++$test;
+ }
+ }
+}
+
+$test = 932; |
@smpeters - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#10054 (status was 'resolved')
Searchable as RT10054$
The text was updated successfully, but these errors were encountered: