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]";}