From: Andreas König Date: Fri, 4 Nov 2005 08:17:25 +0000 (+0100) Subject: [perl #19049] Incorrect $` after replacement X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e0efdaf8e9240c19cd4636de8080d872bb373f7f;p=p5sagit%2Fp5-mst-13.2.git [perl #19049] Incorrect $` after replacement Message-ID: <87fyqc51bu.fsf@k75.linux.bogus> p4raw-id: //depot/perl@25993 --- diff --git a/regexec.c b/regexec.c index e058216..d4ec7c2 100644 --- a/regexec.c +++ b/regexec.c @@ -2177,7 +2177,7 @@ S_regtry(pTHX_ regexp *prog, char *startpos) prog->subbeg = PL_bostr; prog->sublen = PL_regeol - PL_bostr; /* strend may have been modified */ } - prog->startp[0] = startpos - PL_bostr; + /* prog->startp[0] = startpos - PL_bostr; */ PL_reginput = startpos; PL_regstartp = prog->startp; PL_regendp = prog->endp; @@ -2221,6 +2221,7 @@ S_regtry(pTHX_ regexp *prog, char *startpos) #endif REGCP_SET(lastcp); if (regmatch(prog->program + 1)) { + prog->startp[0] = startpos - PL_bostr; prog->endp[0] = PL_reginput - PL_bostr; return 1; } diff --git a/t/op/pat.t b/t/op/pat.t index 10ecaf8..a8d8e3b 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -3196,7 +3196,7 @@ $_ = "x"; s/x/func "in multiline subst"/em; # bug #19049 $_="abcdef\n"; @x = m/./g; -ok("abcde" eq "$`", '# TODO #19049 - global match not setting $`'); +ok("abcde" eq "$`", '#19049 - global match not setting $`'); ok("123\x{100}" =~ /^.*1.*23\x{100}$/, 'uft8 + multiple floating substr'); @@ -3390,7 +3390,7 @@ ok(("foba ba$s" =~ qr/(foo|BaSS|bar)/i) $s = $1; $s = $2; ok($s eq 'cd', - "# TODO assigning to original string should not corrupt match vars"); + "# assigning to original string should not corrupt match vars"); } # last test 1187