On Sat, 6 May 2017, zhanghj wrote: > The doc says: > In TO-STRING, ‘\&’ or ‘\0’ stands for whatever matched the whole of > REGEXP, and ‘\N’ (where N is a digit) stands for whatever matched > the Nth ‘\(...\)’ (1-based) in REGEXP. The ‘\(...\)’ groups are > counted from 1. > > But when using \0, emacs gives the following error message: > match-substitute-replacement: Invalid use of ‘\’ in replacement text > > Using \& is OK. Thanks. The docstring for `query-replace-regexp' was updated in commit 38f4b8ea615 to fix Bug#23884. Apparently, \0 has never referred to the whole match in this command (\& it does), so we might want to skip \0 from this docstring and the manual. Regards, Tino