About the regular expression rollup of PHP

Source: Internet
Author: User
Tags expression integer mail php regular expression regular expression return string
The following is a collection of some of the regular expressions used to organize, to facilitate future reference in the work, I hereby record.     can only enter a number: "^[0-9]*$"     can only enter n digits: "^\d{n}$"     can only enter at least n digits: "^\d{n,}$"     only can input m ~ n digits: "^\d{m,n}$"     can only enter numbers starting with 0 and 0: "^ (0[1-9][0-9]*) $"     can only enter positive real numbers with two decimal places: "^[0-9]+ (. [ 0-9]{2})? $     Only positive real numbers with 1~3 decimal places can be entered: ^[0-9]+ (. [ 0-9]{1,3})? $     can only enter a Non-zero positive integer: "^\+?" [1-9] [0-9]*$     can only enter a Non-zero negative integer: "^\-[1-9][0-9]*$"     can only enter characters of length 3: "^. {3}$     You can only enter a string of 26 English letters: "^[a-za-z]+$"     can only enter a string of 26 uppercase letters: "^[a-z]+$"     can only be entered by 26 Lowercase English character strings: "^[a-z]+$"     only strings consisting of numbers and 26 English letters can be entered: "^[a-za-z0-9]+$"     can only be entered by numbers, 26 English letters or underscore strings: "^\w+$"     Verifying user password: "^[a-za-z]\w{5,17}$" correct format bit: Start with a letter, length between 6~18, can only contain characters, numbers, and underscores     Verify that there are illegal characters ^ (?: [\u4e00-\u9fa5]*\w*\s*) +$     can only enter Chinese characters: "^[\u4e00-\u9fa5]{0,}$"     Verify Email Address: " ^\w+ ([-+.] \w+) *@\w+ ([-.] \w+) *\.\w+ ([-.] \w+) *$ "    validation InterneturL: "^http://" ([\w-]+\.) +[\w-]+ (/[\w-/?%&=]*)? $ "    China phone number verification     matching form such as: 0511-4405222 or 021-87888822 or 021-44055520-555 or (0511) 4405222     Regular expression ((d{3,4}) d{3,4}-)? d{7,8} (-d{3}) * "    China zip code validation   &N Bsp Matching forms such as: 215421     Regular expression "d{6}"     e-mail verification     match form such as: justali@justdn.com   Regular Expression w+ ([-+.] w+) *@w+ ([-.] w+) *.w+ ([-.] w+) * "    ID card verification     matching form such as: 15-bit or 18-bit ID card     regular expression" d{18}d{15} "    common digital validation   &NB Sp Regular expression     "D{n}" n for the specified length     "D{n,m}" N to m length range     Illegal character validation     match the character that excludes illegal characters Furu:     Regular Expression ^ (?: [\u4e00-\u9fa5]*\w*\s*) +$     Date validation     matching forms such as: 20030718,030718     Scope: 1900-- 2099     Regular expression ((({1} {1}) d{2}) [01]{1}d{1}[0-3]{1}d{1}     usages:     View Code Printing & nbsp
 


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.