// P ("hello sir ". matches ("^ h. * "); // true indicates the beginning of the ^ line. * Represents zero or multiple occurrences of any character P ("hello sir ". matches ("^. * "); // false P (" H ". matches ("^ h. * "); // true P (" hello sir ". matches (". * IR $ "); // The End of the true $ row. This sentence is the string P (" hello sir ") ending with IR ". matches (". * I $ "); // false P (" hello sir ". matches (". * r$ "); // true P (" hello sir ". matches ("^ h [A-Z] {1, 3} O \ B. * "); // true \ B indicates the word boundary, such as space, and a blank line break p (" hello sir ". matches ("^ h [A-Z] {1, 3} o. * "); // true P (" hellosir ". matches ("^ h [A-Z] {1, 3} O \ B. * "); // false P (" Hello \ nsir ". matches ("^ h [A-Z] {1, 3} O \ B. * "); // true P (" Hello \ nsir ". matches ("^ h [A-Z] {1, 3} O \ B. * "); // false note \ n only one diagonal line is incorrectly matched // blank line P (" \ n ". matches ("^ [\ s & [^ \ n] * \ N $"); // true indicates that the start is a blank character, but not a line break, appears zero or multiple times, ending with the line break p ("AAA 8888c ". matches (". * \ D {4 }. "); // true P (" aaa8888c ". matches ("^ .. \ D {4 }. "); // true P (" AAA 8888c ". matches ("^ .. \ D {4 }. "); // false, note that there are still white spaces, so the two points do not work P (" AAA 8888c ". matches ("^... \ D {4 }. "); // true P (" AAA 8888c ". matches (". * \ B \ D {4 }. "); // true here it matches \ B with a blank space character P (" aaa8888c ". matches (". * \ D {4 }. "); // true P (" aaa8888c ". matches (". * \ B \ D {4 }. "); // false the error P (" AAA 8888c ". matches ("^... \ D {4} C $ "); // true P (" AAA 8888c ". matches ("A {3 }. \ D {4} C $ "); // true P (" AAA 8888c ". matches ("A {3} \ D {4} C $"); // true // note the following two. The second one is missing a space, so it is wrong. Pay attention to P ("AAA 8888c ". matches ("A {3} \ B \ D {4} C $"); // true P ("AAA 8888c ". matches ("A {3} \ B \ D {4} C $"); // false because a space is missing after {3}
public static void p(Object o) { System.out.println(o); }