Mega Code Archive

 
Categories / Java Tutorial / Regular Expressions
 

POSIX character classes and Java character classes

Character Class Meta-Character Matches \p{Lower}Lowercase letter [a-z] \p{Upper}Uppercase letter [A-Z] \p{ASCII}All ASCII [\x00-\x7F] \p{Alpha}Any lowercase or uppercase letter \p{Digit}A digit [0–9] \p{Alnum}Any letter or digit \p{Punct}Punctuation [!"#$%&'()*+,-./:;?@[\]^_`{|}~] \p{Graph}A visible character: any letter, digit, or punctuation \p{Print}A printable character; same as \p{Graph} \p{Blank}A space or tab [ \t] \p{Cntrl}A control character [\x00-\x1F\x7F] \p{XDigit}Hexadecimal digit [0–9a–fA–F] \p{Space}A whitespace character [ \t\n\x0B\f\r]