/[emacs]/emacs/man/search.texi
ViewVC logotype

Diff of /emacs/man/search.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.60 by rms, Sun Jan 9 01:57:30 2005 UTC revision 1.61 by rms, Wed Mar 23 14:46:18 2005 UTC
# Line 25  asks interactively which occurrences to Line 25  asks interactively which occurrences to
25  * Regexp Search::               Search for match for a regexp.  * Regexp Search::               Search for match for a regexp.
26  * Regexps::                     Syntax of regular expressions.  * Regexps::                     Syntax of regular expressions.
27  * Search Case::                 To ignore case while searching, or not.  * Search Case::                 To ignore case while searching, or not.
 * Configuring Scrolling::       Scrolling within incremental search.  
28  * Replace::                     Search, and replace some or all matches.  * Replace::                     Search, and replace some or all matches.
29  * Other Repeating Search::      Operating on all matches for some regexp.  * Other Repeating Search::      Operating on all matches for some regexp.
30  @end menu  @end menu
31    
32  @node Incremental Search, Nonincremental Search, Search, Search  @node Incremental Search
33  @section Incremental Search  @section Incremental Search
34    
 @cindex incremental search  
35    An incremental search begins searching as soon as you type the first    An incremental search begins searching as soon as you type the first
36  character of the search string.  As you type in the search string, Emacs  character of the search string.  As you type in the search string, Emacs
37  shows you where the string (as you have typed it so far) would be  shows you where the string (as you have typed it so far) would be
# Line 49  Incremental search forward (@code{isearc Line 47  Incremental search forward (@code{isearc
47  Incremental search backward (@code{isearch-backward}).  Incremental search backward (@code{isearch-backward}).
48  @end table  @end table
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    
67  @kindex C-s  @kindex C-s
68  @findex isearch-forward  @findex isearch-forward
69    @kbd{C-s} starts a forward incremental search.  It reads characters    @kbd{C-s} starts a forward incremental search.  It reads characters
# Line 81  special within searches (@kbd{C-q}, @kbd Line 96  special within searches (@kbd{C-q}, @kbd
96  @kbd{C-y}, @kbd{M-y}, @kbd{M-r}, @kbd{M-c}, @kbd{M-e}, and some other  @kbd{C-y}, @kbd{M-y}, @kbd{M-r}, @kbd{M-c}, @kbd{M-e}, and some other
97  meta-characters).  meta-characters).
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
101    there.  In Transient Mark mode, incremental search sets the mark
102    without activating it, and does so only if the mark is not already
103    active.
104    
105    @node Repeat Isearch
106    @subsection Repeating Incremental Search
107    
108    Sometimes you search for @samp{FOO} and find one, but not the one you    Sometimes you search for @samp{FOO} and find one, but not the one you
109  expected to find.  There was a second @samp{FOO} that you forgot  expected to find.  There was a second @samp{FOO} that you forgot
110  about, before the one you were aiming for.  In this event, type  about, before the one you were aiming for.  In this event, type
# Line 92  cancel some @kbd{C-s} characters with @k Line 116  cancel some @kbd{C-s} characters with @k
116  typing just @kbd{C-s C-s}: the first @kbd{C-s} is the key that invokes  typing just @kbd{C-s C-s}: the first @kbd{C-s} is the key that invokes
117  incremental search, and the second @kbd{C-s} means ``search again.''  incremental search, and the second @kbd{C-s} means ``search again.''
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.
121    Repeating a failing reverse search with @kbd{C-r} starts again from
122    the end.  This is called @dfn{wrapping around}, and @samp{Wrapped}
123    appears in the search prompt once this has happened.  If you keep on
124    going past the original starting point of the search, it changes to
125    @samp{Overwrapped}, which means that you are revisiting matches that
126    you have already seen.
127    
128    To reuse earlier search strings, use the @dfn{search ring}.  The    To reuse earlier search strings, use the @dfn{search ring}.  The
129  commands @kbd{M-p} and @kbd{M-n} move through the ring to pick a search  commands @kbd{M-p} and @kbd{M-n} move through the ring to pick a search
130  string to reuse.  These commands leave the selected search ring element  string to reuse.  These commands leave the selected search ring element
# Line 100  string in the minibuffer without replaci Line 133  string in the minibuffer without replaci
133  search ring, type @kbd{M-e}.  Type @kbd{C-s} or @kbd{C-r}  search ring, type @kbd{M-e}.  Type @kbd{C-s} or @kbd{C-r}
134  to terminate editing the string and search for it.  to terminate editing the string and search for it.
135    
136      You can change to searching backwards with @kbd{C-r}.  If a search fails
137    because the place you started was too late in the file, you should do this.
138    Repeated @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
140    with @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
146    a key runs a command (@code{isearch-backward}) to search backward.  A
147    backward search finds matches that are entirely before the starting
148    point, just as a forward search finds matches that begin after it.
149    
150    @node Error in Isearch
151    @subsection Errors in Incremental Search
152    
153    If your string is not found at all, the echo area says @samp{Failing    If your string is not found at all, the echo area says @samp{Failing
154  I-Search}.  The cursor is after the place where Emacs found as much of your  I-Search}.  The cursor is after the place where Emacs found as much of your
155  string as it could.  Thus, if you search for @samp{FOOT}, and there is no  string as it could.  Thus, if you search for @samp{FOOT}, and there is no
# Line 113  removes from the search string the chara Line 163  removes from the search string the chara
163  @samp{FOOT}).  A second @kbd{C-g} at that point cancels the search  @samp{FOOT}).  A second @kbd{C-g} at that point cancels the search
164  entirely, returning point to where it was when the search started.  entirely, returning point to where it was when the search started.
165    
166    @cindex quitting (in search)
167      The @kbd{C-g} ``quit'' character does special things during searches;
168    just what it does depends on the status of the search.  If the search has
169    found what you specified and is waiting for input, @kbd{C-g} cancels the
170    entire 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
172    not been found---because Emacs is still searching for them, or because it
173    has failed to find them---then the search string characters which have not
174    been found are discarded from the search string.  With them gone, the
175    search is now successful and waiting for more input, so a second @kbd{C-g}
176    will cancel the entire search.
177    
178    @node Special Isearch
179    @subsection Special Input for Incremental Search
180    
181    An upper-case letter in the search string makes the search    An upper-case letter in the search string makes the search
182  case-sensitive.  If you delete the upper-case character from the search  case-sensitive.  If you delete the upper-case character from the search
183  string, it ceases to have this effect.  @xref{Search Case}.  string, it ceases to have this effect.  @xref{Search Case}.
# Line 125  following character to be treated the wa Line 190  following character to be treated the wa
190  treated in the same context.  You can also specify a character by its  treated in the same context.  You can also specify a character by its
191  octal code: enter @kbd{C-q} followed by a sequence of octal digits.  octal code: enter @kbd{C-q} followed by a sequence of octal digits.
192    
193      @kbd{M-%} typed in incremental search invokes @code{query-replace}
194    or @code{query-replace-regexp} (depending on search mode) with the
195    current search string used as the string to replace.  @xref{Query
196    Replace}.
197    
198      Entering @key{RET} when the search string is empty launches
199    nonincremental search (@pxref{Nonincremental Search}).
200    
201    @vindex isearch-mode-map
202      To customize the special characters that incremental search understands,
203    alter their bindings in the keymap @code{isearch-mode-map}.  For a list
204    of 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    
210  @cindex searching for non-@acronym{ASCII} characters  @cindex searching for non-@acronym{ASCII} characters
211  @cindex input method, during incremental search  @cindex input method, during incremental search
212    To search for non-@acronym{ASCII} characters, you must use an input method  
213  (@pxref{Input Methods}).  If an input method is enabled in the    To enter non-@acronym{ASCII} characters in an incrementral search,
214  current buffer when you start the search, you can use it while you  you must use an input method (@pxref{Input Methods}).  If an input
215  type the search string also.  Emacs indicates that by including the  method is enabled in the current buffer when you start the search, you
216  input method mnemonic in its prompt, like this:  can use it while you type the search string also.  Emacs indicates
217    that by including the input method mnemonic in its prompt, like this:
218    
219  @example  @example
220  I-search [@var{im}]:  I-search [@var{im}]:
# Line 148  turn on a certain (non-default) input me Line 231  turn on a certain (non-default) input me
231  name of the input method.  The input method you enable during  name of the input method.  The input method you enable during
232  incremental search remains enabled in the current buffer afterwards.  incremental search remains enabled in the current buffer afterwards.
233    
234    If a search is failing and you ask to repeat it by typing another  @node Isearch Yank
235  @kbd{C-s}, it starts again from the beginning of the buffer.  @subsection Isearch Yanking
 Repeating a failing reverse search with @kbd{C-r} starts again from  
 the end.  This is called @dfn{wrapping around}, and @samp{Wrapped}  
 appears in the search prompt once this has happened.  If you keep on  
 going past the original starting point of the search, it changes to  
 @samp{Overwrapped}, which means that you are revisiting matches that  
 you have already seen.  
   
 @cindex quitting (in search)  
   The @kbd{C-g} ``quit'' character does special things during searches;  
 just what it does depends on the status of the search.  If the search has  
 found what you specified and is waiting for input, @kbd{C-g} cancels the  
 entire search.  The cursor moves back to where you started the search.  If  
 @kbd{C-g} is typed when there are characters in the search string that have  
 not been found---because Emacs is still searching for them, or because it  
 has failed to find them---then the search string characters which have not  
 been found are discarded from the search string.  With them gone, the  
 search is now successful and waiting for more input, so a second @kbd{C-g}  
 will cancel the entire search.  
   
   You can change to searching backwards with @kbd{C-r}.  If a search fails  
 because the place you started was too late in the file, you should do this.  
 Repeated @kbd{C-r} keeps looking for more occurrences backwards.  A  
 @kbd{C-s} starts going forwards again.  @kbd{C-r} in a search can be canceled  
 with @key{DEL}.  
   
 @kindex C-r  
 @findex isearch-backward  
   If you know initially that you want to search backwards, you can use  
 @kbd{C-r} instead of @kbd{C-s} to start the search, because @kbd{C-r} as  
 a key runs a command (@code{isearch-backward}) to search backward.  A  
 backward search finds matches that are entirely before the starting  
 point, just as a forward search finds matches that begin after it.  
236    
237    The characters @kbd{C-w} and @kbd{C-y} can be used in incremental    The characters @kbd{C-w} and @kbd{C-y} can be used in incremental
238  search to grab text from the buffer into the search string.  This  search to grab text from the buffer into the search string.  This
# Line 212  string.  It uses the same text that @kbd Line 263  string.  It uses the same text that @kbd
263  @kbd{Mouse-2} in the echo area does the same.  @kbd{Mouse-2} in the echo area does the same.
264  @xref{Yanking}.  @xref{Yanking}.
265    
266    When you exit the incremental search, it sets the mark to where point  @node Highlight Isearch
267  @emph{was}, before the search.  That is convenient for moving back  @subsection Lazy Search Highlighting
 there.  In Transient Mark mode, incremental search sets the mark without  
 activating it, and does so only if the mark is not already active.  
   
   @kbd{M-%} typed in incremental search invokes @code{query-replace}  
 or @code{query-replace-regexp} (depending on search mode) with the  
 current search string used as the string to replace.  @xref{Query  
 Replace}.  
   
268  @cindex lazy search highlighting  @cindex lazy search highlighting
269  @vindex isearch-lazy-highlight  @vindex isearch-lazy-highlight
270    
271    When you pause for a little while during incremental search, it    When you pause for a little while during incremental search, it
272  highlights all other possible matches for the search string.  This  highlights all other possible matches for the search string.  This
273  makes it easier to anticipate where you can get to by typing @kbd{C-s}  makes it easier to anticipate where you can get to by typing @kbd{C-s}
# Line 238  If you don't like this feature, you can Line 282  If you don't like this feature, you can
282  (for all the other matches).  The latter is also used for other matches  (for all the other matches).  The latter is also used for other matches
283  inside @code{query-replace}.  inside @code{query-replace}.
284    
285  @vindex isearch-mode-map  @node Isearch Scroll
   To customize the special characters that incremental search understands,  
 alter their bindings in the keymap @code{isearch-mode-map}.  For a list  
 of bindings, look at the documentation of @code{isearch-mode} with  
 @kbd{C-h f isearch-mode @key{RET}}.  
   
286  @subsection Scrolling During Incremental Search  @subsection Scrolling During Incremental Search
287    
288    Vertical scrolling during incremental search can be enabled by    Vertical scrolling during incremental search can be enabled by
# Line 268  intentional. Line 307  intentional.
307  nevertheless made available under this rubric, since they are likewise  nevertheless made available under this rubric, since they are likewise
308  handy during a search.  handy during a search.
309    
310    For a list of commands which are configured as scrolling commands by    You can make other commands usable within an incremental search by
311  default and instructions on how thus to configure other commands, see  giving the command a non-@code{nil} @code{isearch-scroll} property.
312  @ref{Configuring Scrolling}.  This works for commands that don't permanently change point, the
313    buffer contents, the match data, the current buffer, or the selected
314    window and frame.  The command must not delete the current window and
315    must not itself attempt an incremental search.
316    
317    @node Slow Isearch
318  @subsection Slow Terminal Incremental Search  @subsection Slow Terminal Incremental Search
319    
320    Incremental search on a slow terminal uses a modified style of display    Incremental search on a slow terminal uses a modified style of display
# Line 294  initially 1200.  See @code{baud-rate} in Line 337  initially 1200.  See @code{baud-rate} in
337    The number of lines to use in slow terminal search display is controlled    The number of lines to use in slow terminal search display is controlled
338  by the variable @code{search-slow-window-lines}.  Its normal value is 1.  by the variable @code{search-slow-window-lines}.  Its normal value is 1.
339    
340  @node Nonincremental Search, Word Search, Incremental Search, Search  @node Nonincremental Search
341  @section Nonincremental Search  @section Nonincremental Search
342  @cindex nonincremental search  @cindex nonincremental search
343    
# Line 334  can get to them via the incremental sear Line 377  can get to them via the incremental sear
377  historical reasons, and to avoid the need to find key sequences  historical reasons, and to avoid the need to find key sequences
378  for them.  for them.
379    
380  @node Word Search, Regexp Search, Nonincremental Search, Search  @node Word Search
381  @section Word Search  @section Word Search
382  @cindex word search  @cindex word search
383    
# Line 373  commands may be bound to keys in the usu Line 416  commands may be bound to keys in the usu
416  via the incremental search commands both for historical reasons and  via the incremental search commands both for historical reasons and
417  to avoid the need to find suitable key sequences for them.  to avoid the need to find suitable key sequences for them.
418    
419  @node Regexp Search, Regexps, Word Search, Search  @node Regexp Search
420  @section Regular Expression Search  @section Regular Expression Search
421  @cindex regular expression  @cindex regular expression
422  @cindex regexp  @cindex regexp
# Line 381  to avoid the need to find suitable key s Line 424  to avoid the need to find suitable key s
424    A @dfn{regular expression} (@dfn{regexp}, for short) is a pattern    A @dfn{regular expression} (@dfn{regexp}, for short) is a pattern
425  that denotes a class of alternative strings to match, possibly  that denotes a class of alternative strings to match, possibly
426  infinitely many.  GNU Emacs provides both incremental and  infinitely many.  GNU Emacs provides both incremental and
427  nonincremental ways to search for a match for a regexp.  nonincremental ways to search for a match for a regexp.  The syntax of
428    regular expressions is explained in the following section.
429    
430  @kindex C-M-s  @kindex C-M-s
431  @findex isearch-forward-regexp  @findex isearch-forward-regexp
# Line 429  argument, they perform ordinary string s Line 473  argument, they perform ordinary string s
473  @code{isearch-forward} and @code{isearch-backward}.  @xref{Incremental  @code{isearch-forward} and @code{isearch-backward}.  @xref{Incremental
474  Search}.  Search}.
475    
476  @node Regexps, Search Case, Regexp Search, Search  @node Regexps
477  @section Syntax of Regular Expressions  @section Syntax of Regular Expressions
478  @cindex syntax of regexps  @cindex syntax of regexps
479    
# Line 830  colors, Emacs blinks the cursor around t Line 874  colors, Emacs blinks the cursor around t
874  for matching parens.)  for matching parens.)
875  @end ignore  @end ignore
876    
877  @node Search Case, Configuring Scrolling, Regexps, Search  @node Search Case
878  @section Searching and Case  @section Searching and Case
879    
880    Incremental searches in Emacs normally ignore the case of the text    Incremental searches in Emacs normally ignore the case of the text
# Line 852  current incremental search to the next o Line 896  current incremental search to the next o
896  effect of including an upper-case letter in the current search.  effect of including an upper-case letter in the current search.
897    
898  @vindex case-fold-search  @vindex case-fold-search
899    @vindex default-case-fold-search
900    If you set the variable @code{case-fold-search} to @code{nil}, then    If you set the variable @code{case-fold-search} to @code{nil}, then
901  all letters must match exactly, including case.  This is a per-buffer  all letters must match exactly, including case.  This is a per-buffer
902  variable; altering the variable affects only the current buffer, but  variable; altering the variable affects only the current buffer, but
903  there is a default value which you can change as well.  @xref{Locals}.  there is a default value in @code{default-case-fold-search} that you
904  This variable applies to nonincremental searches also, including those  can also set.  @xref{Locals}.  This variable applies to nonincremental
905  performed by the replace commands (@pxref{Replace}) and the minibuffer  searches also, including those performed by the replace commands
906  history matching commands (@pxref{Minibuffer History}).  (@pxref{Replace}) and the minibuffer history matching commands
907    (@pxref{Minibuffer History}).
 @node Configuring Scrolling, Replace, Search Case, Search  
 @section Configuring Scrolling  
 @cindex scrolling in incremental search  
 @vindex isearch-allow-scroll  
   
 Scrolling, etc., during incremental search is enabled by setting the  
 customizable variable @code{isearch-allow-scroll} to a non-@code{nil} value.  
   
 @c See Subject: Info file:  How do I get an itemized list without blank lines?  
 @c Date: Sat, 12 Apr 2003 09:45:31 +0000  in gnu.emacs.help  
 @subsection Standard scrolling commands  
 Here is the list of commands which are configured by default to be  
 ``scrolling'' commands in an incremental search, together with their  
 usual bindings:  
 @subsubsection Commands which scroll the window:  
 @table @asis  
 @item @code{scroll-bar-toolkit-scroll} (@kbd{@key{vertical-scroll-bar}@key{mouse-1}} in X-Windows)  
 @itemx @code{mac-handle-scroll-bar-event} (@kbd{@key{vertical-scroll-bar}@key{mouse-1}} on a Mac)  
 @itemx @code{w32-handle-scroll-bar-event} (@kbd{@key{vertical-scroll-bar}@key{mouse-1}} in MS-Windows)  
 @item @code{recenter} (@kbd{C-l}) @xref{Scrolling}.  
 @itemx @code{reposition-window} (@kbd{C-M-l}) @xref{Scrolling}.  
 @itemx @code{scroll-up} (@kbd{@key{NEXT}}) @xref{Scrolling}.  
 @itemx @code{scroll-down} (@kbd{@key{PRIOR}}) @xref{Scrolling}.  
 @end table  
   
 @subsubsection Commands which act on the other window:  
 @table @asis  
 @item @code{list-buffers} (@kbd{C-x C-b}) @xref{List Buffers}.  
 @itemx @code{scroll-other-window} (@kbd{C-M-v}) @xref{Other Window}.  
 @itemx @code{scroll-other-window-down} (@kbd{C-M-S-v}) @xref{Other Window}.  
 @itemx @code{beginning-of-buffer-other-window} (@kbd{M-@key{home}})  
 @itemx @code{end-of-buffer-other-window} (@kbd{M-@key{end}})  
 @end table  
   
 @subsubsection Commands which change the window layout:  
 @table @asis  
 @item @code{delete-other-windows} (@kbd{C-x 1}) @xref{Change Window}.  
 @itemx @code{balance-windows} (@kbd{C-x +}) @xref{Change Window}.  
 @itemx @code{split-window-vertically} (@kbd{C-x 2}) @xref{Split Window}.  
 @itemx @code{enlarge-window} (@kbd{C-x ^}) @xref{Change Window}.  
 @end table  
   
 @subsection Configuring other commands as scrolling commands  
 To do this, set a command's isearch-scroll property to the value t.  
 For example:  
   
 @example  
 @code{(put 'my-command 'isearch-scroll t)}  
 @end example  
   
 You should only thus configure commands which are ``safe'': i.e., they  
 won't leave emacs in an inconsistent state when executed within a  
 search---that is to say, the following things may be changed by a  
 command only temporarily, and must be restored before the command  
 finishes:  
908    
909  @enumerate  @node Replace
 @item  
 Point.  
 @item  
 The buffer contents.  
 @item  
 The selected window and selected frame.  
 @item  
 The current match-data.  @xref{Match Data,,, elisp, The Emacs Lisp  
 Reference Manual}.  
 @end enumerate  
   
 Additionally, the command must not delete the current window and must  
 not itself attempt an incremental search.  It may, however, change the  
 window's size, or create or delete other windows and frames.  
   
 Note that an attempt by a command to scroll the text  
 @emph{horizontally} won't work, although it will do no harm---any such  
 scrolling will be overridden and nullified by the display code.  
   
 @node Replace, Other Repeating Search, Configuring Scrolling, Search  
910  @section Replacement Commands  @section Replacement Commands
911  @cindex replacement  @cindex replacement
912  @cindex search-and-replace commands  @cindex search-and-replace commands
# Line 967  parallel using the command @code{expand- Line 937  parallel using the command @code{expand-
937  @node Unconditional Replace, Regexp Replace, Replace, Replace  @node Unconditional Replace, Regexp Replace, Replace, Replace
938  @subsection Unconditional Replacement  @subsection Unconditional Replacement
939  @findex replace-string  @findex replace-string
 @findex replace-regexp  
940    
941  @table @kbd  @table @kbd
942  @item M-x replace-string @key{RET} @var{string} @key{RET} @var{newstring} @key{RET}  @item M-x replace-string @key{RET} @var{string} @key{RET} @var{newstring} @key{RET}
943  Replace every occurrence of @var{string} with @var{newstring}.  Replace every occurrence of @var{string} with @var{newstring}.
 @item M-x replace-regexp @key{RET} @var{regexp} @key{RET} @var{newstring} @key{RET}  
 Replace every match for @var{regexp} with @var{newstring}.  
944  @end table  @end table
945    
946    To replace every instance of @samp{foo} after point with @samp{bar},    To replace every instance of @samp{foo} after point with @samp{bar},
# Line 1008  in your text. Line 975  in your text.
975    
976  @node Regexp Replace, Replacement and Case, Unconditional Replace, Replace  @node Regexp Replace, Replacement and Case, Unconditional Replace, Replace
977  @subsection Regexp Replacement  @subsection Regexp Replacement
978    @findex replace-regexp
979    
980    The @kbd{M-x replace-string} command replaces exact matches for a    The @kbd{M-x replace-string} command replaces exact matches for a
981  single string.  The similar command @kbd{M-x replace-regexp} replaces  single string.  The similar command @kbd{M-x replace-regexp} replaces
982  any match for a specified pattern.  any match for a specified pattern.
983    
984    @table @kbd
985    @item M-x replace-regexp @key{RET} @var{regexp} @key{RET} @var{newstring} @key{RET}
986    Replace every match for @var{regexp} with @var{newstring}.
987    @end table
988    
989    In @code{replace-regexp}, the @var{newstring} need not be constant:    In @code{replace-regexp}, the @var{newstring} need not be constant:
990  it can refer to all or part of what is matched by the @var{regexp}.  it can refer to all or part of what is matched by the @var{regexp}.
991  @samp{\&} in @var{newstring} stands for the entire match being  @samp{\&} in @var{newstring} stands for the entire match being
# Line 1258  ESC}. Line 1231  ESC}.
1231    See also @ref{Transforming File Names}, for Dired commands to rename,    See also @ref{Transforming File Names}, for Dired commands to rename,
1232  copy, or link files by replacing regexp matches in file names.  copy, or link files by replacing regexp matches in file names.
1233    
1234  @node Other Repeating Search,, Replace, Search  @node Other Repeating Search
1235  @section Other Search-and-Loop Commands  @section Other Search-and-Loop Commands
1236    
1237    Here are some other commands that find matches for a regular    Here are some other commands that find matches for a regular

Legend:
Removed from v.1.60  
changed lines
  Added in v.1.61

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26