The Pattern API contains a number of useful predefined character classes.
Character
class
|
Description
|
.
|
Matches any character
|
\d
|
Matches a digit: [0-9]
|
\D
|
Matches a non-digit: [^0-9]
|
\h
|
Matches a horizontal whitespace character: [
\t\xA0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000]
|
\H
|
Matches a non-horizontal whitespace character:
[^\h]
|
\s
|
Matches a whitespace character: [ \t\n\x0B\f\r]
|
\S
|
Matches a non-whitespace character: [^\s]
|
\v
|
Matches a vertical whitespace character:
[\n\x0B\f\r\x85\u2028\u2029]
|
\V
|
Matches a non-vertical whitespace character:
[^\v]
|
\w
|
Matches a word character: [a-zA-Z_0-9]
|
\W
|
Matches a non-word character: [^\w]
|
Prevoius Next Home
No comments:
Post a Comment