Matching Predefined Character Classes
”;
Following are various examples of matching predefined character classes using regular expression in 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: [ tnx0Bfr] |
5 | S
A non-whitespace character: [^s]. |
6 | w
A word character: [a-zA-Z_0-9]. |
7 | W
A non-word character: [^w] |
Advertisements
”;