POSIX Charachter Classes [:class:]

Alternate method of specifying a range of characters to match:

 

  • [:alnum:] matches alphabetic or numeric characters. This is equivalent to A-Za-z0-9
  • [:alpha:] matches alphabetic characters. This is equivalent to A-Za-z
  • [:blank:] matches a space or a tab
  • [:cntrl:] matches control characters
  • [:digit:] matches (decimal) digits. This is equivalent to 0-9
  • [:graph:] (graphic printable characters). Matches characters in the range of ASCII 33 - 126. This is the same as [:print:], below, but excluding the space character
  • [:lower:] matches lowercase alphabetic characters. This is equivalent to a-z
  • [:print:] (printable characters). Matches characters in the range of ASCII 32 - 126. This is the same as [:graph:], above, but adding the space character
  • [:space:] matches whitespace characters (space and horizontal tab)
  • [:upper:] matches uppercase alphabetic characters. This is equivalent to A-Z
  • [:xdigit:] matches hexadecimal digits. This is equivalent to 0-9A-Fa-f

POSIX character classes generally require quoting or double brackets ([[ ]]).