; Document how to search for raw bytes

* doc/emacs/search.texi (Regexps):
* doc/lispref/searching.texi (Regexp Special): Document how to
search for raw bytes.  (Bug#79724)
This commit is contained in:
Eli Zaretskii 2025-10-30 16:39:43 +02:00
parent aeac24349a
commit 1f00179df9
2 changed files with 18 additions and 0 deletions

View file

@ -1125,6 +1125,18 @@ ends of the range in upper case, or both in lower case, or both should
be non-letters. The behavior of a mixed-case range such as @samp{A-z}
is somewhat ill-defined, and it may change in future Emacs versions.
To search for raw bytes (@pxref{International Chars}) using regular
expressions, specify their codepoints in the bracket expression, as in
@w{@kbd{C-M-s [ C-x 8 @key{RET} 3fff80 @key{RET} - C-x 8 @key{RET}
3fffff @key{RET} ]}}. Emacs will show the equivalent
@example
Regexp I-search: [\200-\377]
@end example
@noindent
in the echo area.
@item @kbd{[^ @dots{} ]}
@samp{[^} begins a @dfn{complemented character set}, which matches any
character except the ones specified. Thus, @samp{[^a-z0-9A-Z]} matches

View file

@ -444,6 +444,12 @@ Representations}), or if the range start is ASCII and the end is a raw
byte (as in @samp{[a-\377]}), the range will match only ASCII
characters and raw 8-bit bytes, but not non-ASCII characters. This
feature is intended for searching text in unibyte buffers and strings.
@cindex raw bytes, regexps for searching
@item
To search for @dfn{raw bytes}, which are characters belonging to the
@code{eight-bit} character set (@pxref{Character Sets}), you can use
@samp{[\200-\377]} or @samp{[\x3fff80-\x3fffff]}
@end enumerate
Some kinds of bracket expressions are not the best style even