Mercurial > emacs
changeset 69971:fbf2a5887b37
(Regexp Backslash, Regexp Replace): Add index entries for ``back reference''
and mention the term itself in the text.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Wed, 12 Apr 2006 13:39:58 +0000 |
parents | d5a08c9d58dd |
children | 8de650354007 |
files | man/search.texi |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/man/search.texi Wed Apr 12 12:31:05 2006 +0000 +++ b/man/search.texi Wed Apr 12 13:39:58 2006 +0000 @@ -750,8 +750,9 @@ the numbering of the groups that are meant to be referred to. @item \@var{d} +@cindex back reference, in regexp matches the same text that matched the @var{d}th occurrence of a -@samp{\( @dots{} \)} construct. +@samp{\( @dots{} \)} construct (a.k.a.@: @dfn{back reference}). After the end of a @samp{\( @dots{} \)} construct, the matcher remembers the beginning and end of the text matched by that construct. Then, @@ -1002,15 +1003,16 @@ Replace every match for @var{regexp} with @var{newstring}. @end table +@cindex back reference, in regexp replacement In @code{replace-regexp}, the @var{newstring} need not be constant: it can refer to all or part of what is matched by the @var{regexp}. @samp{\&} in @var{newstring} stands for the entire match being replaced. @samp{\@var{d}} in @var{newstring}, where @var{d} is a digit, stands for whatever matched the @var{d}th parenthesized -grouping in @var{regexp}. @samp{\#} refers to the count of -replacements already made in this command, as a decimal number. In -the first replacement, @samp{\#} stands for @samp{0}; in the second, -for @samp{1}; and so on. For example, +grouping in @var{regexp} (a.k.a.@: ``back reference''). @samp{\#} +refers to the count of replacements already made in this command, as a +decimal number. In the first replacement, @samp{\#} stands for +@samp{0}; in the second, for @samp{1}; and so on. For example, @example M-x replace-regexp @key{RET} c[ad]+r @key{RET} \&-safe @key{RET}