Character Classes

Character classes may appear within other character classes, and may be composed by the union operator (implicit) and the intersection operator (&&). The union operator denotes a class that contains every character that is in at least one of its operand classes. The intersection operator denotes a class that contains every character that is in both of its operand classes.

The precedence of character-class operators is as follows, from highest to lowest:

1Literal escape\x
2Grouping[...]
3Rangea-z
4Union[a-e][i-u]
5Intersection[a-z&&[aeiou]]

Note that the set of meta characters that is in effect inside a character class is different from the set that is outside a character class. For instance, the regular expression . loses its special meaning inside a character class, while the expression - becomes a range forming metacharacter.