Mercurial > hg > xemacs-beta
comparison man/lispref/searching.texi @ 5791:9fae6227ede5
Silence texinfo 5.2 warnings, primarily by adding next, prev, and up
pointers to all nodes. See xemacs-patches message with ID
<5315f7bf.sHpFD7lXYR05GH6E%james@xemacs.org>.
author | Jerry James <james@xemacs.org> |
---|---|
date | Thu, 27 Mar 2014 08:59:03 -0600 |
parents | 3df910176b6a |
children |
comparison
equal
deleted
inserted
replaced
5790:dcf9067f26bb | 5791:9fae6227ede5 |
---|---|
26 @end menu | 26 @end menu |
27 | 27 |
28 The @samp{skip-chars@dots{}} functions also perform a kind of searching. | 28 The @samp{skip-chars@dots{}} functions also perform a kind of searching. |
29 @xref{Skipping Characters}. | 29 @xref{Skipping Characters}. |
30 | 30 |
31 @node String Search | 31 @node String Search, Regular Expressions, Searching and Matching, Searching and Matching |
32 @section Searching for Strings | 32 @section Searching for Strings |
33 @cindex string search | 33 @cindex string search |
34 | 34 |
35 These are the primitive functions for searching through the text in a | 35 These are the primitive functions for searching through the text in a |
36 buffer. They are meant for use in programs, but you may call them | 36 buffer. They are meant for use in programs, but you may call them |
151 @var{string}. This function is just like @code{word-search-forward} | 151 @var{string}. This function is just like @code{word-search-forward} |
152 except that it searches backward and normally leaves point at the | 152 except that it searches backward and normally leaves point at the |
153 beginning of the match. | 153 beginning of the match. |
154 @end deffn | 154 @end deffn |
155 | 155 |
156 @node Regular Expressions | 156 @node Regular Expressions, Regexp Search, String Search, Searching and Matching |
157 @section Regular Expressions | 157 @section Regular Expressions |
158 @cindex regular expression | 158 @cindex regular expression |
159 @cindex regexp | 159 @cindex regexp |
160 | 160 |
161 A @dfn{regular expression} (@dfn{regexp}, for short) is a pattern that | 161 A @dfn{regular expression} (@dfn{regexp}, for short) is a pattern that |
182 * Syntax of Regexps:: Rules for writing regular expressions. | 182 * Syntax of Regexps:: Rules for writing regular expressions. |
183 * Char Classes:: Predefined character classes for searching. | 183 * Char Classes:: Predefined character classes for searching. |
184 * Regexp Example:: Illustrates regular expression syntax. | 184 * Regexp Example:: Illustrates regular expression syntax. |
185 @end menu | 185 @end menu |
186 | 186 |
187 @node Syntax of Regexps | 187 @node Syntax of Regexps, Char Classes, Regular Expressions, Regular Expressions |
188 @subsection Syntax of Regular Expressions | 188 @subsection Syntax of Regular Expressions |
189 | 189 |
190 Regular expressions have a syntax in which a few characters are | 190 Regular expressions have a syntax in which a few characters are |
191 special constructs and the rest are @dfn{ordinary}. An ordinary | 191 special constructs and the rest are @dfn{ordinary}. An ordinary |
192 character is a simple regular expression that matches that character and | 192 character is a simple regular expression that matches that character and |
608 (concat "\\s-" (regexp-quote string) "\\s-")) | 608 (concat "\\s-" (regexp-quote string) "\\s-")) |
609 @end group | 609 @end group |
610 @end example | 610 @end example |
611 @end defun | 611 @end defun |
612 | 612 |
613 @node Char Classes | 613 @node Char Classes, Regexp Example, Syntax of Regexps, Regular Expressions |
614 @subsection Char Classes | 614 @subsection Char Classes |
615 | 615 |
616 These are the predefined character classes available within regular | 616 These are the predefined character classes available within regular |
617 expression character sets, and within @samp{skip-chars-forward} and | 617 expression character sets, and within @samp{skip-chars-forward} and |
618 @samp{skip-chars-backward}, @xref{Skipping Characters}. | 618 @samp{skip-chars-backward}, @xref{Skipping Characters}. |
663 @item [:xdigit:] | 663 @item [:xdigit:] |
664 This matches hexadecimal digits, so the decimal digits @samp{0-9} and the | 664 This matches hexadecimal digits, so the decimal digits @samp{0-9} and the |
665 letters @samp{a-F} and @samp{A-F}. | 665 letters @samp{a-F} and @samp{A-F}. |
666 @end table | 666 @end table |
667 | 667 |
668 @node Regexp Example | 668 @node Regexp Example, , Char Classes, Regular Expressions |
669 @subsection Complex Regexp Example | 669 @subsection Complex Regexp Example |
670 | 670 |
671 Here is a complicated regexp, used by XEmacs to recognize the end of a | 671 Here is a complicated regexp, used by XEmacs to recognize the end of a |
672 sentence together with any whitespace that follows. It is the value of | 672 sentence together with any whitespace that follows. It is the value of |
673 the variable @code{sentence-end}. | 673 the variable @code{sentence-end}. |
725 @item [ \t\n]* | 725 @item [ \t\n]* |
726 Finally, the last part of the pattern matches any additional whitespace | 726 Finally, the last part of the pattern matches any additional whitespace |
727 beyond the minimum needed to end a sentence. | 727 beyond the minimum needed to end a sentence. |
728 @end table | 728 @end table |
729 | 729 |
730 @node Regexp Search | 730 @node Regexp Search, POSIX Regexps, Regular Expressions, Searching and Matching |
731 @section Regular Expression Searching | 731 @section Regular Expression Searching |
732 @cindex regular expression searching | 732 @cindex regular expression searching |
733 @cindex regexp searching | 733 @cindex regexp searching |
734 @cindex searching for regexp | 734 @cindex searching for regexp |
735 | 735 |
960 @result{} t | 960 @result{} t |
961 @end group | 961 @end group |
962 @end example | 962 @end example |
963 @end defun | 963 @end defun |
964 | 964 |
965 @node POSIX Regexps | 965 @node POSIX Regexps, Search and Replace, Regexp Search, Searching and Matching |
966 @section POSIX Regular Expression Searching | 966 @section POSIX Regular Expression Searching |
967 | 967 |
968 The usual regular expression functions do backtracking when necessary | 968 The usual regular expression functions do backtracking when necessary |
969 to handle the @samp{\|} and repetition constructs, but they continue | 969 to handle the @samp{\|} and repetition constructs, but they continue |
970 this only until they find @emph{some} match. Then they succeed and | 970 this only until they find @emph{some} match. Then they succeed and |
1079 match. A negative number means to include that many lines before the match. | 1079 match. A negative number means to include that many lines before the match. |
1080 A positive number means to include that many lines both before and after. | 1080 A positive number means to include that many lines both before and after. |
1081 @end defopt | 1081 @end defopt |
1082 @end ignore | 1082 @end ignore |
1083 | 1083 |
1084 @node Search and Replace | 1084 @node Search and Replace, Match Data, POSIX Regexps, Searching and Matching |
1085 @section Search and Replace | 1085 @section Search and Replace |
1086 @cindex replacement | 1086 @cindex replacement |
1087 | 1087 |
1088 @defun perform-replace from-string replacements query-flag regexp-flag delimited-flag &optional repeat-count map | 1088 @defun perform-replace from-string replacements query-flag regexp-flag delimited-flag &optional repeat-count map |
1089 This function is the guts of @code{query-replace} and related commands. | 1089 This function is the guts of @code{query-replace} and related commands. |
1173 | 1173 |
1174 @item help | 1174 @item help |
1175 Display some help, then ask again. | 1175 Display some help, then ask again. |
1176 @end table | 1176 @end table |
1177 | 1177 |
1178 @node Match Data | 1178 @node Match Data, Searching and Case, Search and Replace, Searching and Matching |
1179 @section The Match Data | 1179 @section The Match Data |
1180 @cindex match data | 1180 @cindex match data |
1181 | 1181 |
1182 XEmacs keeps track of the positions of the start and end of segments of | 1182 XEmacs keeps track of the positions of the start and end of segments of |
1183 text found during a regular expression search. This means, for example, | 1183 text found during a regular expression search. This means, for example, |
1205 * Replacing Match:: Replacing a substring that was matched. | 1205 * Replacing Match:: Replacing a substring that was matched. |
1206 * Entire Match Data:: Accessing the entire match data at once, as a list. | 1206 * Entire Match Data:: Accessing the entire match data at once, as a list. |
1207 * Saving Match Data:: Saving and restoring the match data. | 1207 * Saving Match Data:: Saving and restoring the match data. |
1208 @end menu | 1208 @end menu |
1209 | 1209 |
1210 @node Simple Match Data | 1210 @node Simple Match Data, Replacing Match, Match Data, Match Data |
1211 @subsection Simple Match Data Access | 1211 @subsection Simple Match Data Access |
1212 | 1212 |
1213 This section explains how to use the match data to find out what was | 1213 This section explains how to use the match data to find out what was |
1214 matched by the last search or match operation. | 1214 matched by the last search or match operation. |
1215 | 1215 |
1328 | 1328 |
1329 @noindent | 1329 @noindent |
1330 (In this case, the index returned is a buffer position; the first | 1330 (In this case, the index returned is a buffer position; the first |
1331 character of the buffer counts as 1.) | 1331 character of the buffer counts as 1.) |
1332 | 1332 |
1333 @node Replacing Match | 1333 @node Replacing Match, Entire Match Data, Simple Match Data, Match Data |
1334 @subsection Replacing the Text That Matched | 1334 @subsection Replacing the Text That Matched |
1335 | 1335 |
1336 This function replaces the text matched by the last search with | 1336 This function replaces the text matched by the last search with |
1337 @var{replacement}. | 1337 @var{replacement}. |
1338 | 1338 |
1430 may be used. | 1430 may be used. |
1431 | 1431 |
1432 @end defun | 1432 @end defun |
1433 | 1433 |
1434 | 1434 |
1435 @node Entire Match Data | 1435 @node Entire Match Data, Saving Match Data, Replacing Match, Match Data |
1436 @subsection Accessing the Entire Match Data | 1436 @subsection Accessing the Entire Match Data |
1437 | 1437 |
1438 The functions @code{match-data} and @code{set-match-data} read or | 1438 The functions @code{match-data} and @code{set-match-data} read or |
1439 write the entire match data, all at once. | 1439 write the entire match data, all at once. |
1440 | 1440 |
1496 | 1496 |
1497 @findex store-match-data | 1497 @findex store-match-data |
1498 @code{store-match-data} is an alias for @code{set-match-data}. | 1498 @code{store-match-data} is an alias for @code{set-match-data}. |
1499 @end defun | 1499 @end defun |
1500 | 1500 |
1501 @node Saving Match Data | 1501 @node Saving Match Data, , Entire Match Data, Match Data |
1502 @subsection Saving and Restoring the Match Data | 1502 @subsection Saving and Restoring the Match Data |
1503 | 1503 |
1504 When you call a function that may do a search, you may need to save | 1504 When you call a function that may do a search, you may need to save |
1505 and restore the match data around that call, if you want to preserve the | 1505 and restore the match data around that call, if you want to preserve the |
1506 match data from an earlier search for later use. Here is an example | 1506 match data from an earlier search for later use. Here is an example |
1551 (set-match-data data)))) | 1551 (set-match-data data)))) |
1552 @end group | 1552 @end group |
1553 @end smallexample | 1553 @end smallexample |
1554 @end ignore | 1554 @end ignore |
1555 | 1555 |
1556 @node Searching and Case | 1556 @node Searching and Case, Standard Regexps, Match Data, Searching and Matching |
1557 @section Searching and Case | 1557 @section Searching and Case |
1558 @cindex searching and case | 1558 @cindex searching and case |
1559 | 1559 |
1560 By default, searches in Emacs ignore the case of the text they are | 1560 By default, searches in Emacs ignore the case of the text they are |
1561 searching through; if you specify searching for @samp{FOO}, then | 1561 searching through; if you specify searching for @samp{FOO}, then |
1597 The value of this variable is the default value for | 1597 The value of this variable is the default value for |
1598 @code{case-fold-search} in buffers that do not override it. This is the | 1598 @code{case-fold-search} in buffers that do not override it. This is the |
1599 same as @code{(default-value 'case-fold-search)}. | 1599 same as @code{(default-value 'case-fold-search)}. |
1600 @end defvar | 1600 @end defvar |
1601 | 1601 |
1602 @node Standard Regexps | 1602 @node Standard Regexps, , Searching and Case, Searching and Matching |
1603 @section Standard Regular Expressions Used in Editing | 1603 @section Standard Regular Expressions Used in Editing |
1604 @cindex regexps used standardly in editing | 1604 @cindex regexps used standardly in editing |
1605 @cindex standard regexps used in editing | 1605 @cindex standard regexps used in editing |
1606 | 1606 |
1607 This section describes some variables that hold regular expressions | 1607 This section describes some variables that hold regular expressions |