Character Classes Parent topic

Character Classes

Element
What It Means
Example
[:alpha:]
Any alphabetic characters
.REG. [[:alpha:]] matches abc, def, xxx, but not 123 or @#$.
[:digit:]
Any digit character; functionally equivalent to  \d
.REG. [[:digit:]] matches 1, 12, 123, etc.
[:alnum:]
Any "word" character. That is, any alphanumeric character; functionally equivalent to \w
.REG. [[:alnum:]] matches abc, 123, but not ~!@.
[:space:]
Any white space character; space, new line, tab, non-breaking space, etc.; functionally equivalent to \s
.REG. (vegetable)[[:space:]] matches "vegetable" followed by any white space character. So the phrase "I like a vegetable in my soup" would trigger the regex, but "I like vegetables in my soup" would not.
[:graph:]
Any characters except space, control characters or the like
.REG. [[:graph:]] matches 123, abc, xxx, ><”, but not space or control characters.
[:print:]
Any characters (similar with [:graph:]) but includes the space character
.REG. [[:print:]] matches 123, abc, xxx, ><”, and space characters.
[:cntrl:]
Any control characters (e.g. CTRL + C, CTRL + X)
.REG. [[:cntrl:]] matches 0x03, 0x08, but not abc, 123, !@#.
[:blank:]
Space and tab characters
.REG. [[:blank:]] matches space and tab characters, but not 123, abc, !@#
[:punct:]
Punctuation characters
.REG. [[:punct:]] matches ; : ? ! ~ @ # $ % & * ’r; ”r; , etc., but not 123, abc
[:lower:]
Any lowercase alphabetic characters (Note : ’r;Enable case sensitive matching’ must be enabled or else it will function as [:alnum:])
.REG. [[:lower:]] matches abc, Def, sTress, Do, etc., but not ABC, DEF, STRESS, DO, 123, !@#.
[:upper:]
Any uppercase alphabetic characters (Note : ’r;Enable case sensitive matching’ must be enabled or else it will function as [:alnum:])
.REG. [[:upper:]] matches ABC, DEF, STRESS, DO, Def, Stress, Do, etc., but not abc, 123, !@#.
[:xdigit:]
Digits allowed in a hexadecimal number (0-9a-fA-F)
.REG. [[:xdigit:]] matches 0a, 7E, 0f, etc.