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
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
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.
GNU Emacs 25.0.92.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version
10.9.5 (Build 13F1507))
of 2016-03-05
[Message part 2 (text/html, inline)]
This bug report was last modified 4 years and 171 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.