|
|||||
Character classes: compound | |||||
Prerequisite Concepts |
The operator |
(or
) can be used within a character class to join strings or predefined character classes. The resulting character class matches a character in any of the listed subclasses. For example, the following matches any character likely to appear on a primitive calculator keyboard (a digit, decimal point, or arithmetic operator):
["+=*/." | digit]
The except
keyword can be used to exclude particular characters from a broader character class. For example, the following matches any character, except a right brace:
[any except "}"]
Similarly, the following matches any letter on a push-button telephone keypad:
[uc except "qz"]
Using the |
(or
) operator, several subclasses can be excepted from a character class. Thus, special characters are described by:
[any except letter | digit | white-space]
Prerequisite Concepts Character classes Pattern matching |
---- |