diff options
| author | Richard M. Stallman | 1995-08-08 20:08:09 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-08-08 20:08:09 +0000 |
| commit | d544c776f62b54b76f55e61f00bda00a3cc4f489 (patch) | |
| tree | 4fcc1184564e267edd5eed8a98b153cb24b2bc6e /lispref | |
| parent | 4669fb3c766c4af503aa24ae9987bda7c1cdb40f (diff) | |
| download | emacs-d544c776f62b54b76f55e61f00bda00a3cc4f489.tar.gz emacs-d544c776f62b54b76f55e61f00bda00a3cc4f489.zip | |
Add subexp arg to replace-match.
Diffstat (limited to 'lispref')
| -rw-r--r-- | lispref/searching.texi | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lispref/searching.texi b/lispref/searching.texi index 073c1ae212a..9c8c37e08d3 100644 --- a/lispref/searching.texi +++ b/lispref/searching.texi | |||
| @@ -1079,7 +1079,7 @@ character of the buffer counts as 1.) | |||
| 1079 | @var{replacement}. | 1079 | @var{replacement}. |
| 1080 | 1080 | ||
| 1081 | @cindex case in replacements | 1081 | @cindex case in replacements |
| 1082 | @defun replace-match replacement &optional fixedcase literal string | 1082 | @defun replace-match replacement &optional fixedcase literal string subexp |
| 1083 | This function replaces the text in the buffer (or in @var{string}) that | 1083 | This function replaces the text in the buffer (or in @var{string}) that |
| 1084 | was matched by the last search. It replaces that text with | 1084 | was matched by the last search. It replaces that text with |
| 1085 | @var{replacement}. | 1085 | @var{replacement}. |
| @@ -1127,6 +1127,12 @@ Subexpressions are those expressions grouped inside @samp{\(@dots{}\)}. | |||
| 1127 | @cindex @samp{\} in replacement | 1127 | @cindex @samp{\} in replacement |
| 1128 | @samp{\\} stands for a single @samp{\} in the replacement text. | 1128 | @samp{\\} stands for a single @samp{\} in the replacement text. |
| 1129 | @end table | 1129 | @end table |
| 1130 | |||
| 1131 | If @var{subexp} is non-@code{nil}, that says to replace just | ||
| 1132 | subexpression number @var{subexp} of the regexp that was matched, not | ||
| 1133 | the entire match. For example, after matching @samp{foo \(ba*r\)}, | ||
| 1134 | calling @code{replace-match} with 1 as @var{subexp} means to replace | ||
| 1135 | just the text that matched @samp{\(ba*r\)}. | ||
| 1130 | @end defun | 1136 | @end defun |
| 1131 | 1137 | ||
| 1132 | @node Entire Match Data | 1138 | @node Entire Match Data |