A character class defines a character set. The statement is βmatch one character specified by the classβ. [:digit:]is the POSIX character class, and [ ... ]is the expression in parentheses.
The designation of the POSIX class is valid only inside the expression in parentheses. For example,
[:digit:]if not inside the expression in brackets, it will not be considered a class named POSIX. Most likely, in most flavors character class containing the symbols ( :, d, i, g, t) literally.
source
share