How to check for a variable that contains consecutive letters, all uppercase or all lowercase

Source: Internet
Author: User
How to find a variable that contains consecutive letters, all uppercase or lowercase
$str = "Ads put the home on a LSD to lose weight fell in love with the Sdafgdsfghfdghjgfjghjgfhj Fonsada wasted scholar-bureaucrat by the law 48955235 Saada waste scattered local teacher place immediately understand";
$p = "/\d{5}/i";

Preg_match_all ($p, $str, $result);
Var_dump ($result);
The above can be found in 5 consecutive digits, if changed to a letter, how to write the regular, see the letter (all lowercase or all uppercase consecutive) number of digits Unlimited


------Solution--------------------
/[a-z]| [a-z]+/or/[a-z]/i
------Solution--------------------
Correction:/[a-z]+/i
Above is case insensitive
/[a-z]+/
------Solution--------------------
$p = "/[a-z]{5,}/i";
------Solution--------------------
Wrong. Try it this way.
$p = "/[a-z]{5,}| [A-z] {5,}/";
------Solution--------------------
Landlord's "Number of unlimited" is what mean, can be 0, that is:/[a-z]*/
------Solution--------------------
Full capitalization or full lowercase is:/([a-z]*) | ([a-z]*)/
------Solution--------------------
View letters (all lowercase or all uppercase consecutive) number of digits
It's all lowercase/[a-z]+/.
All caps,/[a-z]+/.

Not sure is wrong, so can't be *

------Solution--------------------
$p = "/[a-z]+/";
A-Z Match case in English
+ occurrences greater than or equal to 1 times
  • 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.