comparison lispref/searching.texi @ 49600:23a1cea22d13

Trailing whitespace deleted.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 04 Feb 2003 14:56:31 +0000
parents bfdd0deae843
children 4556482b5d22 d7ddb3e565de
comparison
equal deleted inserted replaced
49599:5ade352e8d1c 49600:23a1cea22d13
1 @c -*-texinfo-*- 1 @c -*-texinfo-*-
2 @c This is part of the GNU Emacs Lisp Reference Manual. 2 @c This is part of the GNU Emacs Lisp Reference Manual.
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999
4 @c Free Software Foundation, Inc. 4 @c Free Software Foundation, Inc.
5 @c See the file elisp.texi for copying conditions. 5 @c See the file elisp.texi for copying conditions.
6 @setfilename ../info/searching 6 @setfilename ../info/searching
7 @node Searching and Matching, Syntax Tables, Non-ASCII Characters, Top 7 @node Searching and Matching, Syntax Tables, Non-ASCII Characters, Top
8 @chapter Searching and Matching 8 @chapter Searching and Matching
9 @cindex searching 9 @cindex searching
323 If a range starts with a unibyte character @var{c} and ends with a 323 If a range starts with a unibyte character @var{c} and ends with a
324 multibyte character @var{c2}, the range is divided into two parts: one 324 multibyte character @var{c2}, the range is divided into two parts: one
325 is @samp{@var{c}..?\377}, the other is @samp{@var{c1}..@var{c2}}, where 325 is @samp{@var{c}..?\377}, the other is @samp{@var{c1}..@var{c2}}, where
326 @var{c1} is the first character of the charset to which @var{c2} 326 @var{c1} is the first character of the charset to which @var{c2}
327 belongs. 327 belongs.
328 328
329 You cannot always match all non-@sc{ascii} characters with the regular 329 You cannot always match all non-@sc{ascii} characters with the regular
330 expression @code{"[\200-\377]"}. This works when searching a unibyte 330 expression @code{"[\200-\377]"}. This works when searching a unibyte
331 buffer or string (@pxref{Text Representations}), but not in a multibyte 331 buffer or string (@pxref{Text Representations}), but not in a multibyte
332 buffer or string, because many non-@sc{ascii} characters have codes 332 buffer or string, because many non-@sc{ascii} characters have codes
333 above octal 0377. However, the regular expression @code{"[^\000-\177]"} 333 above octal 0377. However, the regular expression @code{"[^\000-\177]"}
668 @comment node-name, next, previous, up 668 @comment node-name, next, previous, up
669 @subsection Complex Regexp Example 669 @subsection Complex Regexp Example
670 670
671 Here is a complicated regexp, used by Emacs to recognize the end of a 671 Here is a complicated regexp, used by Emacs 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}.
674 674
675 First, we show the regexp as a string in Lisp syntax to distinguish 675 First, we show the regexp as a string in Lisp syntax to distinguish
676 spaces from tab characters. The string constant begins and ends with a 676 spaces from tab characters. The string constant begins and ends with a
677 double-quote. @samp{\"} stands for a double-quote as part of the 677 double-quote. @samp{\"} stands for a double-quote as part of the
678 string, @samp{\\} for a backslash as part of the string, @samp{\t} for a 678 string, @samp{\\} for a backslash as part of the string, @samp{\t} for a
687 will see the following: 687 will see the following:
688 688
689 @example 689 @example
690 @group 690 @group
691 sentence-end 691 sentence-end
692 @result{} "[.?!][]\"')@}]*\\($\\| $\\| \\| \\)[ 692 @result{} "[.?!][]\"')@}]*\\($\\| $\\| \\| \\)[
693 ]*" 693 ]*"
694 @end group 694 @end group
695 @end example 695 @end example
696 696
697 @noindent 697 @noindent
1323 1323
1324 @example 1324 @example
1325 @group 1325 @group
1326 (string-match "\\(qu\\)\\(ick\\)" 1326 (string-match "\\(qu\\)\\(ick\\)"
1327 "The quick fox jumped quickly.") 1327 "The quick fox jumped quickly.")
1328 ;0123456789 1328 ;0123456789
1329 @result{} 4 1329 @result{} 4
1330 @end group 1330 @end group
1331 1331
1332 @group 1332 @group
1333 (match-string 0 "The quick fox jumped quickly.") 1333 (match-string 0 "The quick fox jumped quickly.")