📜  匹配的预定义字符类

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


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

Sr.No Construct & Matches
1 .

Any character (may or may not match line terminators).

2 \d

A digit: [0-9].

3 \D

A non-digit: [^0-9].

4 \s

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

5 \S

A non-whitespace character: [^\s].

6 \w

A word character: [a-zA-Z_0-9].

7 \W

A non-word character: [^\w]