Good luck! Please provide a regular expression: the string contains any four or five of the six letters a, B, c, d, e, and f.

Source: Internet
Author: User
Master! Please help me with a regular expression: the string contains any four or five of the six letters a, B, c, d, e, and f! Please provide a regular expression: the string contains four or five of the six letters a, B, c, d, e, and f. thank you! ------ Solution ------------------ [abcdef] {4, 5} ------ solution -------------------- [a-f] {4, master! Please provide a regular expression: the string contains any four or five of the six letters a, B, c, d, e, and f.
Master! Please provide a regular expression: the string contains any four or five of the six letters a, B, c, d, e, and f.

Thank you!

------ Solution --------------------
/[Abcdef] {4, 5 }/
------ Solution --------------------
/[A-f] {4, 5 }/

Repeat allowed.
Duplicate expressions are not allowed, but only code can be written to judge.
------ Solution --------------------
Same as above
------ Solution --------------------
PHP code
$ Str = "adcdel"; function filter ($ str) {preg_match ('/^ \ S {6} $/', $ str, $ match); if (! Empty ($ match [0]) preg_match ('/[a-f] {4, 5}/', $ match [0], $ matchs ); return $ a = isset ($ matchs )? $ Matchs [0]: null;} $ result = filter ($ str); if ($ result) {var_dump ($ result); echo "[[success]";} else {echo "[[failed]";}

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.