All of a sudden, PHP is exactly how to match whether the specified format is satisfied

Source: Internet
Author: User
Suddenly, how does PHP match the specified format?

Very simple request I actually do not know, do not understand which function to use.

The information I ask the user to enter is only a letter and cannot have any other characters: I'm using Preg_match, think carefully, preg_match just matches whether the user input contains letters, not just letters,
For example, user input 123abcd456, if I use Preg_match will get the user input is the correct conclusion, but this is obviously wrong, I want the user input can only be a letter, instead of containing, which function should be used AH?

Thank you

Share to:


------Solution--------------------
/^[a-z]+$/i matches only letters

  • 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.