293 |
|
|
294 |
You can also include character ranges in a character alternative, by |
You can also include character ranges in a character alternative, by |
295 |
writing the starting and ending characters with a @samp{-} between them. |
writing the starting and ending characters with a @samp{-} between them. |
296 |
Thus, @samp{[a-z]} matches any lower-case @sc{ascii} letter. Ranges may be |
Thus, @samp{[a-z]} matches any lower-case @acronym{ASCII} letter. Ranges may be |
297 |
intermixed freely with individual characters, as in @samp{[a-z$%.]}, |
intermixed freely with individual characters, as in @samp{[a-z$%.]}, |
298 |
which matches any lower case @sc{ascii} letter or @samp{$}, @samp{%} or |
which matches any lower case @acronym{ASCII} letter or @samp{$}, @samp{%} or |
299 |
period. |
period. |
300 |
|
|
301 |
Note that the usual regexp special characters are not special inside a |
Note that the usual regexp special characters are not special inside a |
326 |
@var{c1} is the first character of the charset to which @var{c2} |
@var{c1} is the first character of the charset to which @var{c2} |
327 |
belongs. |
belongs. |
328 |
|
|
329 |
You cannot always match all non-@sc{ascii} characters with the regular |
You cannot always match all non-@acronym{ASCII} characters with the regular |
330 |
expression @code{"[\200-\377]"}. This works when searching a unibyte |
expression @code{"[\200-\377]"}. This works when searching a unibyte |
331 |
buffer or string (@pxref{Text Representations}), but not in a multibyte |
buffer or string (@pxref{Text Representations}), but not in a multibyte |
332 |
buffer or string, because many non-@sc{ascii} characters have codes |
buffer or string, because many non-@acronym{ASCII} characters have codes |
333 |
above octal 0377. However, the regular expression @code{"[^\000-\177]"} |
above octal 0377. However, the regular expression @code{"[^\000-\177]"} |
334 |
does match all non-@sc{ascii} characters (see below regarding @samp{^}), |
does match all non-@acronym{ASCII} characters (see below regarding @samp{^}), |
335 |
in both multibyte and unibyte representations, because only the |
in both multibyte and unibyte representations, because only the |
336 |
@sc{ascii} characters are excluded. |
@acronym{ASCII} characters are excluded. |
337 |
|
|
338 |
Starting in Emacs 21, a character alternative can also specify named |
Starting in Emacs 21, a character alternative can also specify named |
339 |
character classes (@pxref{Char Classes}). This is a POSIX feature whose |
character classes (@pxref{Char Classes}). This is a POSIX feature whose |
415 |
|
|
416 |
@table @samp |
@table @samp |
417 |
@item [:ascii:] |
@item [:ascii:] |
418 |
This matches any @sc{ascii} (unibyte) character. |
This matches any @acronym{ASCII} (unibyte) character. |
419 |
@item [:alnum:] |
@item [:alnum:] |
420 |
This matches any letter or digit. (At present, for multibyte |
This matches any letter or digit. (At present, for multibyte |
421 |
characters, it matches anything that has word syntax.) |
characters, it matches anything that has word syntax.) |
425 |
@item [:blank:] |
@item [:blank:] |
426 |
This matches space and tab only. |
This matches space and tab only. |
427 |
@item [:cntrl:] |
@item [:cntrl:] |
428 |
This matches any @sc{ascii} control character. |
This matches any @acronym{ASCII} control character. |
429 |
@item [:digit:] |
@item [:digit:] |
430 |
This matches @samp{0} through @samp{9}. Thus, @samp{[-+[:digit:]]} |
This matches @samp{0} through @samp{9}. Thus, @samp{[-+[:digit:]]} |
431 |
matches any digit, as well as @samp{+} and @samp{-}. |
matches any digit, as well as @samp{+} and @samp{-}. |
432 |
@item [:graph:] |
@item [:graph:] |
433 |
This matches graphic characters---everything except @sc{ascii} control |
This matches graphic characters---everything except @acronym{ASCII} control |
434 |
characters, space, and the delete character. |
characters, space, and the delete character. |
435 |
@item [:lower:] |
@item [:lower:] |
436 |
This matches any lower-case letter, as determined by |
This matches any lower-case letter, as determined by |
437 |
the current case table (@pxref{Case Tables}). |
the current case table (@pxref{Case Tables}). |
438 |
@item [:nonascii:] |
@item [:nonascii:] |
439 |
This matches any non-@sc{ascii} (multibyte) character. |
This matches any non-@acronym{ASCII} (multibyte) character. |
440 |
@item [:print:] |
@item [:print:] |
441 |
This matches printing characters---everything except @sc{ascii} control |
This matches printing characters---everything except @acronym{ASCII} control |
442 |
characters and the delete character. |
characters and the delete character. |
443 |
@item [:punct:] |
@item [:punct:] |
444 |
This matches any punctuation character. (At present, for multibyte |
This matches any punctuation character. (At present, for multibyte |