Regular Expression for JQuery numeric type verification

Source: Internet
Author: User

Var regexEnum =
{
Intege: "^ -? [1-9] // d * $ ", // integer
Intege1: "^ [1-9] // d * $", // positive integer
Intege2: "^-[1-9] // d * $", // negative integer
Num: "^ ([+-]?) // D *//.? // D + $ ", // number
Num1: "^ ([1-9] // d * | 0) $", // positive integer (positive integer + 0)
Num2: "^-[1-9] // d * | 0 $", // negative (negative integer + 0)
Decmal: "^ ([+-]?) // D * //. // d + $ ", // floating point number
Decmal1: "^ [1-9] // d *. // d * | 0. // d * [1-9] // d * $ ", // Positive floating point number
Decmal: "^-([1-9] // d *. // d * | 0. // d * [1-9] // d *) $ ", // negative floating point number
Decm_3: "^ -? ([1-9] // d *. // d * | 0. // d * [1-9] // d * | 0 ?. 0 + | 0) $ ", // floating point number
Decmal4: "^ [1-9] // d *. // d * | 0. // d * [1-9] // d * | 0 ?. 0 + | 0 $ ", // non-negative floating point number (Positive floating point number + 0)
Decmal5: "^ (-([1-9] // d *. // d * | 0. // d * [1-9] // d *) | 0 ?. 0 + | 0 $ ", // non-Positive floating point number (negative floating point number + 0)


Email: "^ // w + (-// w +) | (//. // w +) * // @ [A-Za-z0-9] + ((//. |-) [A-Za-z0-9] + )*//. [A-Za-z0-9] + $ ", // mail
Color: "^ [a-fA-F0-9] {6} $", // color
Url: "^ http [s]? : // ([// W-] + //.) + [// w-] + ([// w -./? % & =] *)? $ ", // Url
Chinese: "^ [// u4E00-// u9FA5 // uF900-// uFA2D] + $", // only chinese
Ascii: "^ [// x00-// xFF] + $", // It is only an acⅱ character.
Zipcode: "^ // d {6} $", // zip code
Mobile: "^ (13 | 15 | 18) [0-9] {9} $", // mobile phone
Ip4: "^ (25 [0-5] | 2 [0-4] // d | [0-1] // d {2} | [1-9]? // D )//. (25 [0-5] | 2 [0-4] // d | [0-1] // d {2} | [1-9]? // D )//. (25 [0-5] | 2 [0-4] // d | [0-1] // d {2} | [1-9]? // D )//. (25 [0-5] | 2 [0-4] // d | [0-1] // d {2} | [1-9]? // D) $ ", // ip address
Notempty: "^/S + $", // not empty
Picture: "(. *) //. (jpg | bmp | gif | ico | pcx | jpeg | tif | png | raw | tga) $", // picture
Rar: "(. *) //. (rar | zip | 7zip | tgz) $", // compress the file
Date: "^ // d {4} (//-| // | /.) // d {1, 2} // 1 // d {1, 2} $ ", // Date
Qq: "^ [1-9] * [1-9] [0-9] * $", // qq number
Tel: "^ ([0 // +] // d {2, 3 }-)? (0 // d {2, 3 })-)? (// D {7, 8}) (-(// d {3 ,}))? $ ", // Phone number function (including domestic area code, international area code, and extension code)
Username: "^ // w + $", // used for user registration. Match a string consisting of digits, 26 English letters, or underscores
Letter: "^ [A-Za-z] + $", // letter
Letter_u: "^ [A-Z] + $", // uppercase letter
Letter_l: "^ [a-z] + $", // lowercase letter
Idcard: "^ [1-9] ([0-9] {14} | [0-9] {17}) $" // ID card
}

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.