[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
13.2.3 Some frequently used character classes
Some standard character classes can be conveniently represented as
metasequences instead of as explicit bracketed expressions. \d
matches a digit ([0-9]
); \s
matches a whitespace
character; and \w
matches a character that could be part of a
“word”.(6)
The upper-case versions of these metasequences stand for the inversions
of the corresponding character classes. Thus \D
matches a
non-digit, \S
a non-whitespace character, and \W
a
non-“word” character.
Remember to include a double backslash when putting these metasequences in a Scheme string:
(pregexp-match "\\d\\d" "0 dear, 1 have 2 read catch 22 before 9") ⇒ ("22")
These character classes can be used inside
a bracketed expression. Eg,
"[a-z\\d]"
matches a lower-case letter
or a digit.
This document was generated on March 31, 2014 using texi2html 5.0.