; Fix recent changes in regexp documentation

* doc/lispref/searching.texi (Regexp Backslash):
* doc/emacs/search.texi (Regexps): Fix typo and wording.
This commit is contained in:
Eli Zaretskii 2022-05-09 16:02:58 +03:00
parent f54a71fa27
commit 04b1f779f2
2 changed files with 18 additions and 14 deletions

View file

@ -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.

View file

@ -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}.