📜  匹配的POSIX字符类

📅  最后修改于: 2020-11-14 10:20:25             🧑  作者: Mango


以下是在Java中使用正则表达式匹配POSIX字符类的各种示例。

Sr.No Construct & Matches
1 \p{Lower}

A lower-case alphabetic character: [a-z].

2 \p{Upper}

An upper-case alphabetic character:[A-Z].

3 \p{ASCII}

All ASCII:[\x00-\x7F].

4 \p{Alpha}

An alphabetic character:[\p{Lower}\p{Upper}].

5 \p{Digit}

A decimal digit: [0-9].

6 \p{Alnum}

An alphanumeric character:[\p{Alpha}\p{Digit}].

7 \p{Punct}

Punctuation: One of !”#$%&'()*+,-./:;<=>?@[\]^_>{|}<.>

8 \p{Graph}

A visible character: [\p{Alnum}\p{Punct}].

9 \p{Print}

A printable character: [\p{Graph}\x20].

10 \p{Blank}

A space or a tab: [ \t].

11 \p{XDigit}

A hexadecimal digit: [0-9a-fA-F].

12 \p{Space}

A whitespace character: [ \t\n\x0B\f\r].