[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r107692: lispref/searching.tex small
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r107692: lispref/searching.tex small edits |
Date: |
Wed, 28 Mar 2012 00:57:42 -0700 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 107692
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Wed 2012-03-28 00:57:42 -0700
message:
lispref/searching.tex small edits
* doc/lispref/searching.texi (Regular Expressions, Regexp Special):
(Regexp Backslash, Regexp Example): Copyedits.
(Regexp Special): Mention collation.
Clarify char classes with an example.
modified:
doc/lispref/ChangeLog
doc/lispref/searching.texi
=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog 2012-03-27 09:22:01 +0000
+++ b/doc/lispref/ChangeLog 2012-03-28 07:57:42 +0000
@@ -1,3 +1,10 @@
+2012-03-28 Glenn Morris <address@hidden>
+
+ * searching.texi (Regular Expressions, Regexp Special):
+ (Regexp Backslash, Regexp Example): Copyedits.
+ (Regexp Special): Mention collation.
+ Clarify char classes with an example.
+
2012-03-27 Martin Rudalics <address@hidden>
* windows.texi (Window History): Describe new option
=== modified file 'doc/lispref/searching.texi'
--- a/doc/lispref/searching.texi 2012-03-27 06:46:42 +0000
+++ b/doc/lispref/searching.texi 2012-03-28 07:57:42 +0000
@@ -241,7 +241,7 @@
@findex re-builder
@cindex regular expressions, developing
- For convenient interactive development of regular expressions, you
+ For interactive development of regular expressions, you
can use the @kbd{M-x re-builder} command. It provides a convenient
interface for creating regular expressions, by giving immediate visual
feedback in a separate buffer. As you edit the regexp, all its
@@ -318,6 +318,7 @@
expression. Thus, @samp{fo*} has a repeating @samp{o}, not a repeating
@samp{fo}. It matches @samp{f}, @samp{fo}, @samp{foo}, and so on.
address@hidden backtracking and regular expressions
The matcher processes a @samp{*} construct by matching, immediately, as
many repetitions as can be found. Then it continues with the rest of
the pattern. If that fails, backtracking occurs, discarding some of the
@@ -387,7 +388,12 @@
@samp{[a-z$%.]}, which matches any lower case @acronym{ASCII} letter
or @samp{$}, @samp{%} or period.
-Note that the usual regexp special characters are not special inside a
+If @code{case-fold-search} is address@hidden, @samp{[a-z]} also
+matches upper-case letters. Note that a range like @samp{[a-z]} is
+not affected by the locale's collation sequence, it always represents
+a sequence in @acronym{ASCII} order.
+
+Note also that the usual regexp special characters are not special inside a
character alternative. A completely different set of characters is
special inside character alternatives: @samp{]}, @samp{-} and @samp{^}.
@@ -395,23 +401,27 @@
first character. For example, @samp{[]a]} matches @samp{]} or @samp{a}.
To include a @samp{-}, write @samp{-} as the first or last character of
the character alternative, or put it after a range. Thus, @samp{[]-]}
-matches both @samp{]} and @samp{-}.
+matches both @samp{]} and @samp{-}. (As explained below, you cannot
+use @samp{\]} to include a @samp{]} inside a character alternative,
+since @samp{\} is not special there.)
To include @samp{^} in a character alternative, put it anywhere but at
the beginning.
address@hidden What if it starts with a multibyte and ends with a unibyte?
address@hidden That doesn't seem to match anything...?
If a range starts with a unibyte character @var{c} and ends with a
multibyte character @var{c2}, the range is divided into two parts: one
-is @address@hidden, the other is @address@hidden@var{c2}}, where
address@hidden is the first character of the charset to which @var{c2}
-belongs.
+spans the unibyte characters @address@hidden, the other the
+multibyte characters @address@hidden@var{c2}}, where @var{c1} is the
+first character of the charset to which @var{c2} belongs.
A character alternative can also specify named character classes
-(@pxref{Char Classes}). This is a POSIX feature whose syntax is
address@hidden:@var{class}:]}. Using a character class is equivalent to
-mentioning each of the characters in that class; but the latter is not
-feasible in practice, since some classes include thousands of
-different characters.
+(@pxref{Char Classes}). This is a POSIX feature. For example,
address@hidden:ascii:]]} matches any @acronym{ASCII} character.
+Using a character class is equivalent to mentioning each of the
+characters in that class; but the latter is not feasible in practice,
+since some classes include thousands of different characters.
@item @samp{[^ @dots{} ]}
@cindex @samp{^} in regexp
@@ -812,7 +822,7 @@
@kindex invalid-regexp
Not every string is a valid regular expression. For example, a string
-that ends inside a character alternative without terminating @samp{]}
+that ends inside a character alternative without a terminating @samp{]}
is invalid, and so is a string that ends with a single @samp{\}. If
an invalid regular expression is passed to any of the search functions,
an @code{invalid-regexp} error is signaled.
@@ -827,20 +837,14 @@
regexp constructed by the function @code{sentence-end}.
@xref{Standard Regexps}.)
- First, we show the regexp as a string in Lisp syntax to distinguish
-spaces from tab characters. The string constant begins and ends with a
+ Below, we show first the regexp as a string in Lisp syntax (to
+distinguish spaces from tab characters), and then the result of
+evaluating it. The string constant begins and ends with a
double-quote. @samp{\"} stands for a double-quote as part of the
string, @samp{\\} for a backslash as part of the string, @samp{\t} for a
tab and @samp{\n} for a newline.
@example
-"[.?!][]\"')@}]*\\($\\| $\\|\t\\|@ @ \\)[ \t\n]*"
address@hidden example
-
address@hidden
-In contrast, if you evaluate this string, you will see the following:
-
address@hidden
@group
"[.?!][]\"')@}]*\\($\\| $\\|\t\\|@ @ \\)[ \t\n]*"
@result{} "[.?!][]\"')@}]*\\($\\| $\\| \\|@ @ \\)[
@@ -849,7 +853,7 @@
@end example
@noindent
-In this output, tab and newline appear as themselves.
+In the output, tab and newline appear as themselves.
This regular expression contains four parts in succession and can be
deciphered as follows:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r107692: lispref/searching.tex small edits,
Glenn Morris <=