Predefined Character Classes

Predefined Character Classes

The Pattern API contains a number of useful predefined character classes, which offer convenient shorthands for commonly used regular expressions:

Construct Description
. Any character (may or may not match line terminators)
\d A digit: [0-9]
\D A non-digit: [^0-9]
\s A whitespace character: [ \t\n\x0B\f\r]
\S A non-whitespace character: [^\s]
\w A word character: [a-zA-Z_0-9]
\W A non-word character: [^\w]

 

https://docs.oracle.com/javase/tutorial/essential/regex/pre_char_classes.html

 

猜你喜欢

转载自oywl2008.iteye.com/blog/2370923
今日推荐