aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-03-23 14:46:18 +0000
committerRichard M. Stallman2005-03-23 14:46:18 +0000
commitf2fd3623780e633e6203925975f7b17230597380 (patch)
tree9ceada372f6240fed6163fd5604a8f3a66117a87
parentec9bd3442520633f2904dae7e883c76b69ebf721 (diff)
downloademacs-f2fd3623780e633e6203925975f7b17230597380.tar.gz
emacs-f2fd3623780e633e6203925975f7b17230597380.zip
Delete explicit node pointers.
(Incremental Search): New menu. (Basic Isearch, Repeat Isearch, Error in Isearch) (Non-Ascii Isearch, Isearch Yank, Highlight Isearch, Isearch Scroll) (Slow Isearch): New subnodes. (Configuring Scrolling): Node deleted. (Search Case): Doc default-case-fold-search. (Regexp Replace): Move replace-regexp doc here.
-rw-r--r--man/search.texi277
1 files changed, 125 insertions, 152 deletions
diff --git a/man/search.texi b/man/search.texi
index 1e4d9ea53c6..a947d4ecfb4 100644
--- a/man/search.texi
+++ b/man/search.texi
@@ -25,15 +25,13 @@ asks interactively which occurrences to replace.
25* Regexp Search:: Search for match for a regexp. 25* Regexp Search:: Search for match for a regexp.
26* Regexps:: Syntax of regular expressions. 26* Regexps:: Syntax of regular expressions.
27* Search Case:: To ignore case while searching, or not. 27* Search Case:: To ignore case while searching, or not.
28* Configuring Scrolling:: Scrolling within incremental search.
29* Replace:: Search, and replace some or all matches. 28* Replace:: Search, and replace some or all matches.
30* Other Repeating Search:: Operating on all matches for some regexp. 29* Other Repeating Search:: Operating on all matches for some regexp.
31@end menu 30@end menu
32 31
33@node Incremental Search, Nonincremental Search, Search, Search 32@node Incremental Search
34@section Incremental Search 33@section Incremental Search
35 34
36@cindex incremental search
37 An incremental search begins searching as soon as you type the first 35 An incremental search begins searching as soon as you type the first
38character of the search string. As you type in the search string, Emacs 36character of the search string. As you type in the search string, Emacs
39shows you where the string (as you have typed it so far) would be 37shows you where the string (as you have typed it so far) would be
@@ -49,6 +47,23 @@ Incremental search forward (@code{isearch-forward}).
49Incremental search backward (@code{isearch-backward}). 47Incremental search backward (@code{isearch-backward}).
50@end table 48@end table
51 49
50@menu
51* Basic Isearch:: Basic incremental search commands.
52* Repeat Isearch:: Searching for the same string again.
53* Error in Isearch:: When your string is not found.
54* Special Isearch:: Special input in incremental search.
55* Non-ASCII Isearch:: How to search for non-ASCII characters.
56* Isearch Yank:: Commands that grab text into the search string
57 or else edit the search string.
58* Highlight Isearch:: Isearch highlights the other possible matches.
59* Isearch Scroll:: Scrolling during an incremental search.
60* Slow Isearch:: Incremental search features for slow terminals.
61@end menu
62
63@node Basic Isearch
64@subsection Basics of Incremental Search
65@cindex incremental search
66
52@kindex C-s 67@kindex C-s
53@findex isearch-forward 68@findex isearch-forward
54 @kbd{C-s} starts a forward incremental search. It reads characters 69 @kbd{C-s} starts a forward incremental search. It reads characters
@@ -81,6 +96,15 @@ special within searches (@kbd{C-q}, @kbd{C-w}, @kbd{C-r}, @kbd{C-s},
81@kbd{C-y}, @kbd{M-y}, @kbd{M-r}, @kbd{M-c}, @kbd{M-e}, and some other 96@kbd{C-y}, @kbd{M-y}, @kbd{M-r}, @kbd{M-c}, @kbd{M-e}, and some other
82meta-characters). 97meta-characters).
83 98
99 When you exit the incremental search, it sets the mark where point
100@emph{was} before the search. That is convenient for moving back
101there. In Transient Mark mode, incremental search sets the mark
102without activating it, and does so only if the mark is not already
103active.
104
105@node Repeat Isearch
106@subsection Repeating Incremental Search
107
84 Sometimes you search for @samp{FOO} and find one, but not the one you 108 Sometimes you search for @samp{FOO} and find one, but not the one you
85expected to find. There was a second @samp{FOO} that you forgot 109expected to find. There was a second @samp{FOO} that you forgot
86about, before the one you were aiming for. In this event, type 110about, before the one you were aiming for. In this event, type
@@ -92,6 +116,15 @@ cancel some @kbd{C-s} characters with @key{DEL}.
92typing just @kbd{C-s C-s}: the first @kbd{C-s} is the key that invokes 116typing just @kbd{C-s C-s}: the first @kbd{C-s} is the key that invokes
93incremental search, and the second @kbd{C-s} means ``search again.'' 117incremental search, and the second @kbd{C-s} means ``search again.''
94 118
119 If a search is failing and you ask to repeat it by typing another
120@kbd{C-s}, it starts again from the beginning of the buffer.
121Repeating a failing reverse search with @kbd{C-r} starts again from
122the end. This is called @dfn{wrapping around}, and @samp{Wrapped}
123appears in the search prompt once this has happened. If you keep on
124going past the original starting point of the search, it changes to
125@samp{Overwrapped}, which means that you are revisiting matches that
126you have already seen.
127
95 To reuse earlier search strings, use the @dfn{search ring}. The 128 To reuse earlier search strings, use the @dfn{search ring}. The
96commands @kbd{M-p} and @kbd{M-n} move through the ring to pick a search 129commands @kbd{M-p} and @kbd{M-n} move through the ring to pick a search
97string to reuse. These commands leave the selected search ring element 130string to reuse. These commands leave the selected search ring element
@@ -100,6 +133,23 @@ string in the minibuffer without replacing it with items from the
100search ring, type @kbd{M-e}. Type @kbd{C-s} or @kbd{C-r} 133search ring, type @kbd{M-e}. Type @kbd{C-s} or @kbd{C-r}
101to terminate editing the string and search for it. 134to terminate editing the string and search for it.
102 135
136 You can change to searching backwards with @kbd{C-r}. If a search fails
137because the place you started was too late in the file, you should do this.
138Repeated @kbd{C-r} keeps looking for more occurrences backwards. A
139@kbd{C-s} starts going forwards again. @kbd{C-r} in a search can be canceled
140with @key{DEL}.
141
142@kindex C-r
143@findex isearch-backward
144 If you know initially that you want to search backwards, you can use
145@kbd{C-r} instead of @kbd{C-s} to start the search, because @kbd{C-r} as
146a key runs a command (@code{isearch-backward}) to search backward. A
147backward search finds matches that are entirely before the starting
148point, just as a forward search finds matches that begin after it.
149
150@node Error in Isearch
151@subsection Errors in Incremental Search
152
103 If your string is not found at all, the echo area says @samp{Failing 153 If your string is not found at all, the echo area says @samp{Failing
104I-Search}. The cursor is after the place where Emacs found as much of your 154I-Search}. The cursor is after the place where Emacs found as much of your
105string as it could. Thus, if you search for @samp{FOOT}, and there is no 155string as it could. Thus, if you search for @samp{FOOT}, and there is no
@@ -113,6 +163,21 @@ removes from the search string the characters that could not be found (the
113@samp{FOOT}). A second @kbd{C-g} at that point cancels the search 163@samp{FOOT}). A second @kbd{C-g} at that point cancels the search
114entirely, returning point to where it was when the search started. 164entirely, returning point to where it was when the search started.
115 165
166@cindex quitting (in search)
167 The @kbd{C-g} ``quit'' character does special things during searches;
168just what it does depends on the status of the search. If the search has
169found what you specified and is waiting for input, @kbd{C-g} cancels the
170entire search. The cursor moves back to where you started the search. If
171@kbd{C-g} is typed when there are characters in the search string that have
172not been found---because Emacs is still searching for them, or because it
173has failed to find them---then the search string characters which have not
174been found are discarded from the search string. With them gone, the
175search is now successful and waiting for more input, so a second @kbd{C-g}
176will cancel the entire search.
177
178@node Special Isearch
179@subsection Special Input for Incremental Search
180
116 An upper-case letter in the search string makes the search 181 An upper-case letter in the search string makes the search
117case-sensitive. If you delete the upper-case character from the search 182case-sensitive. If you delete the upper-case character from the search
118string, it ceases to have this effect. @xref{Search Case}. 183string, it ceases to have this effect. @xref{Search Case}.
@@ -125,13 +190,31 @@ following character to be treated the way any ``ordinary'' character is
125treated in the same context. You can also specify a character by its 190treated in the same context. You can also specify a character by its
126octal code: enter @kbd{C-q} followed by a sequence of octal digits. 191octal code: enter @kbd{C-q} followed by a sequence of octal digits.
127 192
193 @kbd{M-%} typed in incremental search invokes @code{query-replace}
194or @code{query-replace-regexp} (depending on search mode) with the
195current search string used as the string to replace. @xref{Query
196Replace}.
197
198 Entering @key{RET} when the search string is empty launches
199nonincremental search (@pxref{Nonincremental Search}).
200
201@vindex isearch-mode-map
202 To customize the special characters that incremental search understands,
203alter their bindings in the keymap @code{isearch-mode-map}. For a list
204of bindings, look at the documentation of @code{isearch-mode} with
205@kbd{C-h f isearch-mode @key{RET}}.
206
207@node Non-Ascii Isearch
208@subsection Isearch for Non-@acronym{ASCII} Characters
209
128@cindex searching for non-@acronym{ASCII} characters 210@cindex searching for non-@acronym{ASCII} characters
129@cindex input method, during incremental search 211@cindex input method, during incremental search
130 To search for non-@acronym{ASCII} characters, you must use an input method 212
131(@pxref{Input Methods}). If an input method is enabled in the 213 To enter non-@acronym{ASCII} characters in an incrementral search,
132current buffer when you start the search, you can use it while you 214you must use an input method (@pxref{Input Methods}). If an input
133type the search string also. Emacs indicates that by including the 215method is enabled in the current buffer when you start the search, you
134input method mnemonic in its prompt, like this: 216can use it while you type the search string also. Emacs indicates
217that by including the input method mnemonic in its prompt, like this:
135 218
136@example 219@example
137I-search [@var{im}]: 220I-search [@var{im}]:
@@ -148,40 +231,8 @@ turn on a certain (non-default) input method with @kbd{C-^}
148name of the input method. The input method you enable during 231name of the input method. The input method you enable during
149incremental search remains enabled in the current buffer afterwards. 232incremental search remains enabled in the current buffer afterwards.
150 233
151 If a search is failing and you ask to repeat it by typing another 234@node Isearch Yank
152@kbd{C-s}, it starts again from the beginning of the buffer. 235@subsection Isearch Yanking
153Repeating a failing reverse search with @kbd{C-r} starts again from
154the end. This is called @dfn{wrapping around}, and @samp{Wrapped}
155appears in the search prompt once this has happened. If you keep on
156going past the original starting point of the search, it changes to
157@samp{Overwrapped}, which means that you are revisiting matches that
158you have already seen.
159
160@cindex quitting (in search)
161 The @kbd{C-g} ``quit'' character does special things during searches;
162just what it does depends on the status of the search. If the search has
163found what you specified and is waiting for input, @kbd{C-g} cancels the
164entire search. The cursor moves back to where you started the search. If
165@kbd{C-g} is typed when there are characters in the search string that have
166not been found---because Emacs is still searching for them, or because it
167has failed to find them---then the search string characters which have not
168been found are discarded from the search string. With them gone, the
169search is now successful and waiting for more input, so a second @kbd{C-g}
170will cancel the entire search.
171
172 You can change to searching backwards with @kbd{C-r}. If a search fails
173because the place you started was too late in the file, you should do this.
174Repeated @kbd{C-r} keeps looking for more occurrences backwards. A
175@kbd{C-s} starts going forwards again. @kbd{C-r} in a search can be canceled
176with @key{DEL}.
177
178@kindex C-r
179@findex isearch-backward
180 If you know initially that you want to search backwards, you can use
181@kbd{C-r} instead of @kbd{C-s} to start the search, because @kbd{C-r} as
182a key runs a command (@code{isearch-backward}) to search backward. A
183backward search finds matches that are entirely before the starting
184point, just as a forward search finds matches that begin after it.
185 236
186 The characters @kbd{C-w} and @kbd{C-y} can be used in incremental 237 The characters @kbd{C-w} and @kbd{C-y} can be used in incremental
187search to grab text from the buffer into the search string. This 238search to grab text from the buffer into the search string. This
@@ -212,18 +263,11 @@ string. It uses the same text that @kbd{C-y} as a command would yank.
212@kbd{Mouse-2} in the echo area does the same. 263@kbd{Mouse-2} in the echo area does the same.
213@xref{Yanking}. 264@xref{Yanking}.
214 265
215 When you exit the incremental search, it sets the mark to where point 266@node Highlight Isearch
216@emph{was}, before the search. That is convenient for moving back 267@subsection Lazy Search Highlighting
217there. In Transient Mark mode, incremental search sets the mark without
218activating it, and does so only if the mark is not already active.
219
220 @kbd{M-%} typed in incremental search invokes @code{query-replace}
221or @code{query-replace-regexp} (depending on search mode) with the
222current search string used as the string to replace. @xref{Query
223Replace}.
224
225@cindex lazy search highlighting 268@cindex lazy search highlighting
226@vindex isearch-lazy-highlight 269@vindex isearch-lazy-highlight
270
227 When you pause for a little while during incremental search, it 271 When you pause for a little while during incremental search, it
228highlights all other possible matches for the search string. This 272highlights all other possible matches for the search string. This
229makes it easier to anticipate where you can get to by typing @kbd{C-s} 273makes it easier to anticipate where you can get to by typing @kbd{C-s}
@@ -238,12 +282,7 @@ If you don't like this feature, you can turn it off by setting
238(for all the other matches). The latter is also used for other matches 282(for all the other matches). The latter is also used for other matches
239inside @code{query-replace}. 283inside @code{query-replace}.
240 284
241@vindex isearch-mode-map 285@node Isearch Scroll
242 To customize the special characters that incremental search understands,
243alter their bindings in the keymap @code{isearch-mode-map}. For a list
244of bindings, look at the documentation of @code{isearch-mode} with
245@kbd{C-h f isearch-mode @key{RET}}.
246
247@subsection Scrolling During Incremental Search 286@subsection Scrolling During Incremental Search
248 287
249 Vertical scrolling during incremental search can be enabled by 288 Vertical scrolling during incremental search can be enabled by
@@ -268,10 +307,14 @@ intentional.
268nevertheless made available under this rubric, since they are likewise 307nevertheless made available under this rubric, since they are likewise
269handy during a search. 308handy during a search.
270 309
271 For a list of commands which are configured as scrolling commands by 310 You can make other commands usable within an incremental search by
272default and instructions on how thus to configure other commands, see 311giving the command a non-@code{nil} @code{isearch-scroll} property.
273@ref{Configuring Scrolling}. 312This works for commands that don't permanently change point, the
313buffer contents, the match data, the current buffer, or the selected
314window and frame. The command must not delete the current window and
315must not itself attempt an incremental search.
274 316
317@node Slow Isearch
275@subsection Slow Terminal Incremental Search 318@subsection Slow Terminal Incremental Search
276 319
277 Incremental search on a slow terminal uses a modified style of display 320 Incremental search on a slow terminal uses a modified style of display
@@ -294,7 +337,7 @@ initially 1200. See @code{baud-rate} in @ref{Display Custom}.
294 The number of lines to use in slow terminal search display is controlled 337 The number of lines to use in slow terminal search display is controlled
295by the variable @code{search-slow-window-lines}. Its normal value is 1. 338by the variable @code{search-slow-window-lines}. Its normal value is 1.
296 339
297@node Nonincremental Search, Word Search, Incremental Search, Search 340@node Nonincremental Search
298@section Nonincremental Search 341@section Nonincremental Search
299@cindex nonincremental search 342@cindex nonincremental search
300 343
@@ -334,7 +377,7 @@ can get to them via the incremental search commands exists for
334historical reasons, and to avoid the need to find key sequences 377historical reasons, and to avoid the need to find key sequences
335for them. 378for them.
336 379
337@node Word Search, Regexp Search, Nonincremental Search, Search 380@node Word Search
338@section Word Search 381@section Word Search
339@cindex word search 382@cindex word search
340 383
@@ -373,7 +416,7 @@ commands may be bound to keys in the usual manner. They are available
373via the incremental search commands both for historical reasons and 416via the incremental search commands both for historical reasons and
374to avoid the need to find suitable key sequences for them. 417to avoid the need to find suitable key sequences for them.
375 418
376@node Regexp Search, Regexps, Word Search, Search 419@node Regexp Search
377@section Regular Expression Search 420@section Regular Expression Search
378@cindex regular expression 421@cindex regular expression
379@cindex regexp 422@cindex regexp
@@ -381,7 +424,8 @@ to avoid the need to find suitable key sequences for them.
381 A @dfn{regular expression} (@dfn{regexp}, for short) is a pattern 424 A @dfn{regular expression} (@dfn{regexp}, for short) is a pattern
382that denotes a class of alternative strings to match, possibly 425that denotes a class of alternative strings to match, possibly
383infinitely many. GNU Emacs provides both incremental and 426infinitely many. GNU Emacs provides both incremental and
384nonincremental ways to search for a match for a regexp. 427nonincremental ways to search for a match for a regexp. The syntax of
428regular expressions is explained in the following section.
385 429
386@kindex C-M-s 430@kindex C-M-s
387@findex isearch-forward-regexp 431@findex isearch-forward-regexp
@@ -429,7 +473,7 @@ argument, they perform ordinary string search, like
429@code{isearch-forward} and @code{isearch-backward}. @xref{Incremental 473@code{isearch-forward} and @code{isearch-backward}. @xref{Incremental
430Search}. 474Search}.
431 475
432@node Regexps, Search Case, Regexp Search, Search 476@node Regexps
433@section Syntax of Regular Expressions 477@section Syntax of Regular Expressions
434@cindex syntax of regexps 478@cindex syntax of regexps
435 479
@@ -830,7 +874,7 @@ colors, Emacs blinks the cursor around the matched text, as it does
830for matching parens.) 874for matching parens.)
831@end ignore 875@end ignore
832 876
833@node Search Case, Configuring Scrolling, Regexps, Search 877@node Search Case
834@section Searching and Case 878@section Searching and Case
835 879
836 Incremental searches in Emacs normally ignore the case of the text 880 Incremental searches in Emacs normally ignore the case of the text
@@ -852,91 +896,17 @@ current incremental search to the next one, but it does override the
852effect of including an upper-case letter in the current search. 896effect of including an upper-case letter in the current search.
853 897
854@vindex case-fold-search 898@vindex case-fold-search
899@vindex default-case-fold-search
855 If you set the variable @code{case-fold-search} to @code{nil}, then 900 If you set the variable @code{case-fold-search} to @code{nil}, then
856all letters must match exactly, including case. This is a per-buffer 901all letters must match exactly, including case. This is a per-buffer
857variable; altering the variable affects only the current buffer, but 902variable; altering the variable affects only the current buffer, but
858there is a default value which you can change as well. @xref{Locals}. 903there is a default value in @code{default-case-fold-search} that you
859This variable applies to nonincremental searches also, including those 904can also set. @xref{Locals}. This variable applies to nonincremental
860performed by the replace commands (@pxref{Replace}) and the minibuffer 905searches also, including those performed by the replace commands
861history matching commands (@pxref{Minibuffer History}). 906(@pxref{Replace}) and the minibuffer history matching commands
862 907(@pxref{Minibuffer History}).
863@node Configuring Scrolling, Replace, Search Case, Search
864@section Configuring Scrolling
865@cindex scrolling in incremental search
866@vindex isearch-allow-scroll
867
868Scrolling, etc., during incremental search is enabled by setting the
869customizable variable @code{isearch-allow-scroll} to a non-@code{nil} value.
870
871@c See Subject: Info file: How do I get an itemized list without blank lines?
872@c Date: Sat, 12 Apr 2003 09:45:31 +0000 in gnu.emacs.help
873@subsection Standard scrolling commands
874Here is the list of commands which are configured by default to be
875``scrolling'' commands in an incremental search, together with their
876usual bindings:
877@subsubsection Commands which scroll the window:
878@table @asis
879@item @code{scroll-bar-toolkit-scroll} (@kbd{@key{vertical-scroll-bar}@key{mouse-1}} in X-Windows)
880@itemx @code{mac-handle-scroll-bar-event} (@kbd{@key{vertical-scroll-bar}@key{mouse-1}} on a Mac)
881@itemx @code{w32-handle-scroll-bar-event} (@kbd{@key{vertical-scroll-bar}@key{mouse-1}} in MS-Windows)
882@item @code{recenter} (@kbd{C-l}) @xref{Scrolling}.
883@itemx @code{reposition-window} (@kbd{C-M-l}) @xref{Scrolling}.
884@itemx @code{scroll-up} (@kbd{@key{NEXT}}) @xref{Scrolling}.
885@itemx @code{scroll-down} (@kbd{@key{PRIOR}}) @xref{Scrolling}.
886@end table
887
888@subsubsection Commands which act on the other window:
889@table @asis
890@item @code{list-buffers} (@kbd{C-x C-b}) @xref{List Buffers}.
891@itemx @code{scroll-other-window} (@kbd{C-M-v}) @xref{Other Window}.
892@itemx @code{scroll-other-window-down} (@kbd{C-M-S-v}) @xref{Other Window}.
893@itemx @code{beginning-of-buffer-other-window} (@kbd{M-@key{home}})
894@itemx @code{end-of-buffer-other-window} (@kbd{M-@key{end}})
895@end table
896
897@subsubsection Commands which change the window layout:
898@table @asis
899@item @code{delete-other-windows} (@kbd{C-x 1}) @xref{Change Window}.
900@itemx @code{balance-windows} (@kbd{C-x +}) @xref{Change Window}.
901@itemx @code{split-window-vertically} (@kbd{C-x 2}) @xref{Split Window}.
902@itemx @code{enlarge-window} (@kbd{C-x ^}) @xref{Change Window}.
903@end table
904
905@subsection Configuring other commands as scrolling commands
906To do this, set a command's isearch-scroll property to the value t.
907For example:
908
909@example
910@code{(put 'my-command 'isearch-scroll t)}
911@end example
912
913You should only thus configure commands which are ``safe'': i.e., they
914won't leave emacs in an inconsistent state when executed within a
915search---that is to say, the following things may be changed by a
916command only temporarily, and must be restored before the command
917finishes:
918
919@enumerate
920@item
921Point.
922@item
923The buffer contents.
924@item
925The selected window and selected frame.
926@item
927The current match-data. @xref{Match Data,,, elisp, The Emacs Lisp
928Reference Manual}.
929@end enumerate
930
931Additionally, the command must not delete the current window and must
932not itself attempt an incremental search. It may, however, change the
933window's size, or create or delete other windows and frames.
934 908
935Note that an attempt by a command to scroll the text 909@node Replace
936@emph{horizontally} won't work, although it will do no harm---any such
937scrolling will be overridden and nullified by the display code.
938
939@node Replace, Other Repeating Search, Configuring Scrolling, Search
940@section Replacement Commands 910@section Replacement Commands
941@cindex replacement 911@cindex replacement
942@cindex search-and-replace commands 912@cindex search-and-replace commands
@@ -967,13 +937,10 @@ parallel using the command @code{expand-region-abbrevs}
967@node Unconditional Replace, Regexp Replace, Replace, Replace 937@node Unconditional Replace, Regexp Replace, Replace, Replace
968@subsection Unconditional Replacement 938@subsection Unconditional Replacement
969@findex replace-string 939@findex replace-string
970@findex replace-regexp
971 940
972@table @kbd 941@table @kbd
973@item M-x replace-string @key{RET} @var{string} @key{RET} @var{newstring} @key{RET} 942@item M-x replace-string @key{RET} @var{string} @key{RET} @var{newstring} @key{RET}
974Replace every occurrence of @var{string} with @var{newstring}. 943Replace every occurrence of @var{string} with @var{newstring}.
975@item M-x replace-regexp @key{RET} @var{regexp} @key{RET} @var{newstring} @key{RET}
976Replace every match for @var{regexp} with @var{newstring}.
977@end table 944@end table
978 945
979 To replace every instance of @samp{foo} after point with @samp{bar}, 946 To replace every instance of @samp{foo} after point with @samp{bar},
@@ -1008,11 +975,17 @@ in your text.
1008 975
1009@node Regexp Replace, Replacement and Case, Unconditional Replace, Replace 976@node Regexp Replace, Replacement and Case, Unconditional Replace, Replace
1010@subsection Regexp Replacement 977@subsection Regexp Replacement
978@findex replace-regexp
1011 979
1012 The @kbd{M-x replace-string} command replaces exact matches for a 980 The @kbd{M-x replace-string} command replaces exact matches for a
1013single string. The similar command @kbd{M-x replace-regexp} replaces 981single string. The similar command @kbd{M-x replace-regexp} replaces
1014any match for a specified pattern. 982any match for a specified pattern.
1015 983
984@table @kbd
985@item M-x replace-regexp @key{RET} @var{regexp} @key{RET} @var{newstring} @key{RET}
986Replace every match for @var{regexp} with @var{newstring}.
987@end table
988
1016 In @code{replace-regexp}, the @var{newstring} need not be constant: 989 In @code{replace-regexp}, the @var{newstring} need not be constant:
1017it can refer to all or part of what is matched by the @var{regexp}. 990it can refer to all or part of what is matched by the @var{regexp}.
1018@samp{\&} in @var{newstring} stands for the entire match being 991@samp{\&} in @var{newstring} stands for the entire match being
@@ -1258,7 +1231,7 @@ ESC}.
1258 See also @ref{Transforming File Names}, for Dired commands to rename, 1231 See also @ref{Transforming File Names}, for Dired commands to rename,
1259copy, or link files by replacing regexp matches in file names. 1232copy, or link files by replacing regexp matches in file names.
1260 1233
1261@node Other Repeating Search,, Replace, Search 1234@node Other Repeating Search
1262@section Other Search-and-Loop Commands 1235@section Other Search-and-Loop Commands
1263 1236
1264 Here are some other commands that find matches for a regular 1237 Here are some other commands that find matches for a regular