These take the form of "\p{Keyword}
" and "\P{Keyword}
" for normal and
negated variants.
Code | Description | Represents | Notes |
---|---|---|---|
Alpha | any letter | [a-zA-Z] | |
Upper | uppercase letters | [A-Z] | |
Lower | lowercase letters | [a-z] | |
Digit | decimal digit | [0-9] | |
Alnum | alphanumeric | [a-zA-Z0-9] | this is not the same as \w since it excludes "_ "
|
XDigit | hexadecimal digit | [a-fA-F0-9] | |
Punct | punctuation | [!"#$%&'()*+,-./:;<=>?@\[\\\]\^_`|{}~] | |
Graph | graphic character | [\p{Alnum}\p{Punct}] | |
printable character | [\x20-\x7E] | Graph and space (excludes newlines and tab). | |
Blank | tab or space | [ \t] | |
Space | any whitespace | \s | |
Cntrl | any control character | [\x00-\x1F\x7F] |
These keywords are case-sensitive - i.e. "\p{alpha}
" will cause an error.
Note also that the "[:alpha:]
" syntax used by other regex implementations does
not work.