B.2 Character Classes

The following table describes character matching syntax:

Table B.2

List of Character Classes

Character Class

Description

.

Matches any character except \n. When within a character class, the . will be treated as a period character.

[aeiou]

Matches any single character in the specified set of characters.

[^aeiou]

Matches any single character not in the specified set of characters.

[0-9a-fA-F]

Use of a hyphen (-) allows specification of contiguous character ranges.

\p{name}

Matches any character in the Unicode general category specified by name (for example, Ll, Nd, Z).

See the "B.3 Supported Unicode General Categories", for details on the Unicode general category.

\w

Matches any word character, which includes letters, digits, and underscores.

\W

Matches any non-word character.

\s

Matches any whitespace character.

\S

Matches any non-whitespace character.

\d

Matches any decimal digit.

\D

Matches any non-digit.

[.\w\s]

Escaped built-in character classes such as \w and \s may be used in a character class. This example matches any period, word or whitespace character.