P ("\ n \ r \ t ". matches ("\ s {4}"); // true white space character \ s: [\ t \ n \ x0b \ f \ r] P ("". matches ("\ s"); // false indicates that \ s is not a blank character: [^ \ s], so it is false P ("a_8 ". matches ("\ W {3}"); // true P ("abc888 & ^ % ". matches ("[A-Z] {1, 3} \ D + [& ^ # %] + ")); // true indicates that [A-Z] {1, 3} indicates that the character appears three times, \ D + multiple numbers [& ^ # %] + one of the four in brackets appears once or multiple times // or write P ("abc888 & ^ % ". matches ("[A-Z] {3} \ D {3} [& ^ %] +"); // true P ("\\". matches ("\\\\"); // true note \ refers to a \ // P ("\\". matches ("\"); // such If two \ s are followed, the system prompts Unexpected internal error near Index 1. Incorrect syntax // note \ P {upper} Or \ P {lower} can only judge one character, not the string P ("". matches ("\ P {lower}"); // true description \ P {lower} lowercase letter: [A-Z] P ("dafdsfad ". matches ("\ W {2,}"); // true P ("dafdsafad ". matches ("[A-Z] +"); // false P ("dafdsfad ". matches ("[A-Z] +"); // true // you can use the following method to match lowercase strings, because [A-Z] + itself represents multiple lowercase letters P ("dafdsfaddfdsf ". matches ("[A-Z & \ P {lower}] +"); // true P ("". matches ("\ P {lower}"); // false P ("AA ". matches ("\ P {lower}"); // false P ("AA ". matches ("\ P {lower} \ P {upper}"); // true P ("". matches ("\ P {upper}"); // true description \ P {upper} uppercase letter character: [A-Z] P ("AB ". matches ("\ P {upper}"); // false P ("AB ". matches ("\ P {upper} \ P {lower}"); // true P ("". matches ("\ P {space}"); // true \ P {space} blank character: [\ t \ n \ x0b \ f \ r]