Every day a bit of regular expression accumulation (iii) __ Regular expressions

Source: Internet
Author: User
Tags lowercase
        P ("\n\r\t". Matches ("\\s{4}");//true name \s whitespace character: [\t\n\x0b\f\r] P ("". Matches ("\\s"));//false description \s Non-white-space characters: [ ^\s] so is false p ("A_8". Matches ("\\w{3}")),//true p ("abc888&^%". Matches ("[a-z]{1,3}\\d+[&^#%]+")); A true description [a-z]{1,3} represents a character that appears three times, \\d+ number appears one or more of the four inside brackets in the &^#%]+, or write P ("abc888&^%"). Matches ("[A-Z ]{3}\\d{3}[&^%]+ "));//true p (" \ R ") (" \\\\ ");//true note that the previous refers to a \//p (" \ ". Matches (" \ ")); The face of the two is not correct, prompted unexpected internal error near index 1. Incorrect syntax//Note \\p{upper} or \\p{lower} can only judge one character, not the string P ("a". Matches ("\\p{lower}"));//true description \p{lower} lowercase alphabetic characters: [A-Z ] P ("Dafdsfad". Matches ("\\w{2,}"));//true p ("Dafdsafad". Matches ("[a-z]+"));//false p ("Dafdsfad". M Atches ("[a-z]+"));//true//can match lowercase strings in the following way, of course, because [a-z]+ itself represents more than one lowercase letter p ("DAFDSFADDFDSF". Matches ("[a-z& amp;&\\p{lower}]+ "));//true p (" A ". Matches (" \\p{lower} "));//false p (" AA ". MaTches ("\\p{lower}"));//false p ("AA". Matches ("\\p{lower}\\p{upper}"));//true p ("A". Matches ("\\p{upper}")); /true Description \p{upper} uppercase characters: [A-z] p ("AB". Matches ("\\p{upper}");//false p ("AB". Matches ("\\p{upper}\\p{lower}" );//true p ("". Matches ("\\p{space}"));  True \p{space} whitespace characters: [\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.