1 、-? \\d+ One or no minus, followed by several numbers;
2, (-|\\+)? \\d+ a minus sign or a plus sign or none, followed by a number of numbers;
3, \\w+ One or more non-word characters;
4, \\w+ one or more word characters;
5, (ABC) + one or more ABC;
6, abc+ AB followed by one or more C;
7, (ABC) {2,} ABC appears at least 2 times consecutively;
8, (ABC) {2} ABC appeared exactly 2 times;
9, (ABC) {2,5} ABC appears at least two times, up to 5 times;
10. \\s+ one or more whitespace characters
11, Pattern.compile () can compile a regular expression to get a pattern object, the Pattern object has Matcher () method can match string, return a Matcher object, Matcher object has some methods:
(1) Find () returns a Boolean value that specifies that there is no match;
(2) Find (i) returns a match from the I position of the string to be matched;
(3) Group () returns the matching part;
(4) Group (i) returns the matching part of the first part of the regular expression to match the string;
(5) Start () end () returns the position of the matching part
Java Learning Note-4 regular expressions