A little regular expression accumulation every day (3)

Source: Internet
Author: User
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]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.