Bracket
expressions are a list of characters and/or character classes enclosed
in brackets []. Use bracket expressions to match single characters
in a list, or a range of characters in a list. If the first character
of the list is the carat ^ then it matches characters that are not
in the list.
For example:
[abc] |
a, b, or c |
[a-z] |
a through z |
[^abc] |
Any character except a, b, or c |
[[:alpha:]] |
Any alphabetic character (see below) |
Each character class designates a set of characters
equivalent to the corresponding standard C isXXX function. For example,
[:alpha:] designates those characters for which isalpha() returns
true (example: any alphabetic character). Character classes must
be within bracket expression.
[:alpha:] |
Alphabetic characters |
[:digit:] |
Digits |
[:alnum:] |
Alphabetic characters and numeric characters |
[:cntrl:] |
Control character |
[:blank:] |
Space and tab |
[:space:] |
All white space characters |
[:graph:] |
Non-blank (not spaces, control characters, or
the like)
|
[:print:] |
Like [:graph:], but includes the space character |
[:punct:] |
Punctuation characters |
[:lower:] |
Lowercase alphabetic |
[:upper:] |
Uppercase alphabetic |
[:xdigit:] |
Digits allowed in a hexadecimal number (0-9a-fA-F) |
For a case-insensitive expression, [:lower:]
and [:upper:] are equivalent to [:alpha:].