POSIX character classes

Some of the character classes to use in regular expressions.

alpha Any letter, [A-Za-z]
upper Any uppercase letter, [A-Z]
lower Any lowercase letter, [a-z]
digit Any digit, [0-9]
alnum Any alphanumeric character, [A-Za-z0-9]
xdigit Any hexadecimal digit, [0-9A-Fa-f]
space A tab, new line, vertical tab, form feed, carriage return, or space
print Any printable character
punct Any punctuation character:
! ' # S % & ' ( ) * + , - . / : ; < = > ? @ [ / ] ^ _ { | } ~
graph Any character defined as a printable character except those defined as part of the space character class
cntrl Any character not part of the character classes:
[:upper:], [:lower:], [:alpha:], [:digit:], [:punct:], [:graph:], [:print:], [:xdigit:]

Tags: 

Share

You might also be interested in...