Generally, the regular expression of the number is verified.

Source: Internet
Author: User

Regular Expression controls in VS often use string verification during project creation. In addition to not providing a full range of functions, some may not complete verification, such as phone number verification, only eight phone numbers can be verified. Now, there are only eight phone numbers and seven phone numbers, and sometimes we need to add a zone number, which brings a lot of problems to the verification, therefore, we have found some unverified regular expressions on the Internet, which are also accumulated and will be much more convenient to use in the future. Verify the number's regular expression set verification number: ^ [0-9] * $ verify the n-digit number: ^ \ d {n} $ verify the number of at least n digits: ^ \ d {n ,}$ verify the m-n digit: ^ \ d {m, n }$ verify the number starting with zero or zero: ^ (0 | [1-9] [0-9] *) $ verify the positive number of two decimal places: ^ [0-9] + (. [0-9] {2 })? $ Verify the positive number of 1-3 decimal places: ^ [0-9] + (. [0-9] {1, 3 })? $ Verify a non-zero positive integer: ^ \ +? [1-9] [0-9] * $ verify a non-zero negative integer: ^ \-[1-9] [0-9] * $ verify a non-negative integer (positive integer + 0) ^ \ d + $ verify a non-positive integer (negative integer + 0) ^ (-\ d +) | (0 +) $ verify a 3-character length: ^. {3} $ verify A string consisting of 26 English letters: ^ [A-Za-z] + $ verify A string consisting of 26 uppercase English letters: ^ [A-Z] + $ verify a string consisting of 26 lower-case English letters: ^ [a-z] + $ verify a string consisting of digits and 26 English letters: ^ [A-Za-z0-9] + $ verify a string consisting of digits, 26 letters, or underscores: ^ \ w + $ verify user password: ^ [a-zA-Z] \ w {5, 17} $ the correct format is: it must start with a letter and be between 6 and 18 characters. It can only contain characters, numbers, and underscores. Check whether ^ % & ',; =? $ \ "And other characters: [^ % & ',; =? $ \ X22] + verify Chinese characters: ^ [\ u4e00-\ u9fa5], {0,} $ verify Email address: ^ \ w + [-+.] \ w +) * @ \ w + ([-.] \ w + )*\. \ w + ([-.] \ w +) * $ verify InternetURL: ^ http: // ([\ w-] + \.) + [\ w-] + (/[\ w -. /? % & =] *)? $; ^ [A-zA-z] +: // (w + (-w +) *) (. (w + (-w + )*))*(? S *)? $ Verification phone number: ^ (\ d {3, 4} \) | \ d {3, 4 }-)? \ D {7,8} $: -- the correct format is: XXXX-XXXXXXX, XXXX-XXXXXXXX, XXX-XXXXXXX, XXX-XXXXXXXX, XXXXXXX, XXXXXXXX. Verify ID card number (15 or 18 digits): ^ \ d {15} | \ d {} 18 $ verify 12 months of a year: ^ (0? [1-9] | 1 [0-2]) $ the correct format is: "01"-"09" and "1" "12" to verify the 31 days of a month: ^ (0? [1-9]) | (1 | 2) [0-9]) | 30 | 31) $ the correct format is: 01, 09, 1, 31. Integer: ^ -? \ D + $ non-negative floating point number (Positive floating point number + 0): ^ \ d + (\. \ d + )? $ Positive floating point ^ ([0-9] + \. [0-9] * [1-9] [0-9] *) | ([0-9] * [1-9] [0-9] * \. [0-9] +) | ([0-9] * [1-9] [0-9] *) $ non-Positive floating point number (negative floating point number + 0) ^ (-\ d + (\. \ d + )?) | (0 + (\. 0 + )?)) $ Negative floating point number ^ (-([0-9] + \. [0-9] * [1-9] [0-9] *) | ([0-9] * [1-9] [0-9] * \. [0-9] +) | ([0-9] * [1-9] [0-9] *) $ floating point number ^ (-? \ D +) (\. \ d + )?

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.