commit 5bd5bcd06a60f309c744ca469cd163ef844744ff
parent a13cd6a1775b03c20b5f6e9feb0060ced8768efb
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Tue, 5 Mar 2024 15:50:15 +0100
docs: mention backreferences (for replacements with regular expressions)
Also mention that nano prompts for each occurrence, and that, when
a region is marked, replacements are made only within that region.
Diffstat:
1 file changed, 25 insertions(+), 8 deletions(-)
diff --git a/doc/nano.texi b/doc/nano.texi
@@ -310,15 +310,32 @@ If needed, it can be toggled off manually with another @kbd{^6} or @kbd{M-A}.
@node Search and Replace
@section Search and Replace
-One can search the current buffer for the occurrence of any string
-with the Search command (default key binding: @kbd{^W}). The default search
+With the Search command (@kbd{^F} or @kbd{^W}) one can search the
+current buffer for the occurrence of any string. The default search
mode is forward, case-insensitive, and for literal strings. But one
-can search backwards by pressing @kbd{M-B}, search case sensitively with @kbd{M-C},
-and interpret regular expressions in the search string with @kbd{M-R}.
-
-A regular expression in a search string always covers just one line;
-it cannot span multiple lines. And when replacing (with @kbd{^\} or @kbd{M-R})
-the replacement string cannot contain a newline (LF).
+can search backwards by toggling @kbd{M-B}, search case sensitively
+with @kbd{M-C}, and interpret regular expressions in the search string
+with @kbd{M-R}.
+
+With the Replacement command (@kbd{M-R} or @kbd{^\}) one can replace
+a given string (or regular expression) with another string.
+When a regular expression contains fragments between parentheses,
+the replacement string can refer back to these fragments via
+@code{\1} to @code{\9}.
+
+For each occurrence of the search string you will be asked whether to
+replace it. You can choose Yes (replace it), or No (skip this one),
+or All (replace all remaining occurrences without asking any more),
+or Cancel (stop with replacing, but replacements that have already
+been made will not be undone).
+
+If before a replacing session starts a region is marked, then
+only occurrences of the search string within the marked region
+will be replaced.
+
+A regular expression always covers just one line --- it cannot span
+multiple lines. And neither a search string nor a replacement string
+can contain a newline (LF).
@node Using the Mouse
@section Using the Mouse