bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suggestion: check for \n, \t in regexp for query-replace-regexp


From: David Kastrup
Subject: Re: Suggestion: check for \n, \t in regexp for query-replace-regexp
Date: 03 Dec 2001 10:23:39 +0100

>>>>> "Richard" == Richard Stallman <rms@gnu.org> writes:

 RMS> I made it warn about such input but not reject it.
 RMS> After all, you might want to replace a backslash and an n.

 DK>     In which case you were supposed to say \\n, not \n.

 RMS> The argument of query-replace is not a regular expression.

Well, the thread is about query-replace-regexp.  If we are talking
about the replacement string of that (which has not been apparent to
me), then we are indeed not in regexp position.  But even then the
Emacs manual says:

   In `replace-regexp', the NEWSTRING need not be constant: it can
refer to all or part of what is matched by the REGEXP.  `\&' in
NEWSTRING stands for the entire match being replaced.  `\D' in
NEWSTRING, where D is a digit, stands for whatever matched the Dth
parenthesized grouping in REGEXP.  To include a `\' in the text to
replace with, you must enter `\\'.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Email: David.Kastrup@t-online.de



reply via email to

[Prev in Thread] Current Thread [Next in Thread]