GNU bug report logs -
#15107
24.3; replace-regexp-in-string wrong on \`
Previous Next
Reported by: Kevin Ryde <user42 <at> zip.com.au>
Date: Thu, 15 Aug 2013 22:17:02 UTC
Severity: normal
Tags: confirmed, patch
Merged with 44861
Found in versions 24.3, 25.1, 27.1
Done: Mattias EngdegÄrd <mattiase <at> acm.org>
Bug is archived. No further changes may be made.
Full log
Message #12 received at control <at> debbugs.gnu.org (full text, mbox):
tags 15107 confirmed
found 15107 25.1
quit
Michael Wright <wrightmikea <at> gmail.com> writes:
> Kevin Ryde <user42 <at> zip.com.au> writes:
>
>> replace-regexp-in-string behaves incorrectly if a regexp has \` among
>> its matches.
>>
>> (replace-regexp-in-string "\\`\\|X" "Z" "--XX--" t t)
>> =>
>> "Z--ZXZX--"
>>
>> where I expected
>>
>> "Z--ZZ--"
>>
>> This seems to be due to the optimization in replace-regexp-in-string
>> which re-matches on the matched substring. \' can match the substring
>> where it did not match in the middle of the full string. In the example
>> above "X" is the match in the full string, but on taking that "X" as a
>> substring it can match "\\`".
>
> I built the emacs-25 git branch I recreated the above bug today.
Still the case in 25.1-rc1
This bug report was last modified 4 years and 170 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.