[:
... :]
)
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
alpha
blank
cntrl
digit
graph
print
except omits space
lower
print
punct
space
upper
xdigit
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.