Go to the previous, next section.

Character Class Operators ([: ... :])

If the syntax bit RE_CHARACTER_CLASSES is set, then Regex recognizes character class expressions inside lists. A character class expression matches one character from a given class. You form a character class expression by putting a character class name between an open-character-class operator (represented by `[:') and a close-character-class operator (represented by `:]'). The character class names and their meanings are:

alnum
letters and digits

alpha
letters

blank
system-dependent; for GNU, a space or tab

cntrl
control characters (in the ASCII encoding, code 0177 and codes less than 040)

digit
digits

graph
same as print except omits space

lower
lowercase letters

print
printable characters (in the ASCII encoding, space tilde--codes 040 through 0176)

punct
neither control nor alphanumeric characters

space
space, carriage return, newline, vertical tab, and form feed

upper
uppercase letters

xdigit
hexadecimal digits: 0--9, a--f, A--F

These correspond to the definitions in the C library's `<ctype.h>' facility. For example, `[:alpha:]' corresponds to the standard facility isalpha. Regex recognizes character class expressions only inside of lists; so `[[:alpha:]]' matches any letter, but `[:alpha:]' outside of a bracket expression and not followed by a repetition operator matches just itself.

Go to the previous, next section.