[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 04b1f779f2: ; Fix recent changes in regexp documentation
From: |
Eli Zaretskii |
Subject: |
master 04b1f779f2: ; Fix recent changes in regexp documentation |
Date: |
Mon, 9 May 2022 09:03:42 -0400 (EDT) |
branch: master
commit 04b1f779f2e37cea854b40f0cc8e7f6221dcf6fd
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
; Fix recent changes in regexp documentation
* doc/lispref/searching.texi (Regexp Backslash):
* doc/emacs/search.texi (Regexps): Fix typo and wording.
---
doc/emacs/search.texi | 15 +++++++++------
doc/lispref/searching.texi | 17 +++++++++--------
2 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index 81f4d26e03..b123ef83a1 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -1027,9 +1027,11 @@ you search for @samp{a.*?$} against the text
@samp{abbab} followed by
a newline, it matches the whole string. Since it @emph{can} match
starting at the first @samp{a}, it does.
+@cindex set of alternative characters, in regular expressions
+@cindex character set, in regular expressions
@item @kbd{[ @dots{} ]}
-is a @dfn{a set of alternative characters}, beginning with @samp{[}
-and terminated by @samp{]}.
+is a @dfn{set of alternative characters}, or a @dfn{character set},
+beginning with @samp{[} and terminated by @samp{]}.
In the simplest case, the characters between the two brackets are what
this set can match. Thus, @samp{[ad]} matches either one @samp{a} or
@@ -1046,9 +1048,10 @@ which matches any lower-case @acronym{ASCII} letter or
@samp{$}, @samp{%} or
period. As another example, @samp{[α-ωί]} matches all lower-case
Greek letters.
+@cindex character classes, in regular expressions
You can also include certain special @dfn{character classes} in a
character set. A @samp{[:} and balancing @samp{:]} enclose a
-character class inside a character alternative. For instance,
+character class inside a set of alternative characters. For instance,
@samp{[[:alnum:]]} matches any letter or digit. @xref{Char Classes,,,
elisp, The Emacs Lisp Reference Manual}, for a list of character
classes.
@@ -1116,10 +1119,10 @@ no preceding expression on which the @samp{*} can act.
It is poor practice
to depend on this behavior; it is better to quote the special character anyway,
regardless of where it appears.
-As a @samp{\} is not special inside a character alternative, it can
+As a @samp{\} is not special inside a set of alternative characters, it can
never remove the special meaning of @samp{-}, @samp{^} or @samp{]}.
-So you should not quote these characters when they have no special
-meaning either. This would not clarify anything, since backslashes
+You should not quote these characters when they have no special
+meaning. This would not clarify anything, since backslashes
can legitimately precede these characters where they @emph{have}
special meaning, as in @samp{[^\]} (@code{"[^\\]"} for Lisp string
syntax), which matches any single character except a backslash.
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index 976f8b4b4b..21a2c6c51e 100644
--- a/doc/lispref/searching.texi
+++ b/doc/lispref/searching.texi
@@ -550,8 +550,8 @@ special character anyway, regardless of where it appears.
As a @samp{\} is not special inside a character alternative, it can
never remove the special meaning of @samp{-}, @samp{^} or @samp{]}.
-So you should not quote these characters when they have no special
-meaning either. This would not clarify anything, since backslashes
+You should not quote these characters when they have no special
+meaning. This would not clarify anything, since backslashes
can legitimately precede these characters where they @emph{have}
special meaning, as in @samp{[^\]} (@code{"[^\\]"} for Lisp string
syntax), which matches any single character except a backslash.
@@ -825,12 +825,13 @@ matches any character whose syntax is not @var{code}.
@cindex category, regexp search for
@item \c@var{code}
matches any character whose category is @var{code}. Here @var{code}
-is a character that represents a category: thus, @samp{code} for
-Chinese characters or @samp{g} for Greek characters in the standard
-category table. You can see the list of all the currently defined
-categories with @kbd{M-x describe-categories @key{RET}}. You can also
-define your own categories in addition to the standard ones using the
-@code{define-category} function (@pxref{Categories}).
+is a character that represents a category: for example, in the standard
+category table, @samp{c} stands for Chinese characters and @samp{g}
+stands for Greek characters. You can see the list of all the
+currently defined categories with @w{@kbd{M-x describe-categories
+@key{RET}}}. You can also define your own categories in addition to
+the standard ones using the @code{define-category} function
+(@pxref{Categories}).
@item \C@var{code}
matches any character whose category is not @var{code}.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 04b1f779f2: ; Fix recent changes in regexp documentation,
Eli Zaretskii <=