Validate.plugin.js Verification Plugin

Source: Internet
Author: User

/*Write Time: 2015-6-4*/(function ($) {$.fn.isvalidate=function (obj) {if($( This). val ()! ="") {            varTXT = $ ( This). Val ();//form elements: Input        }        varreg; Switch(obj) { Case 0: Reg=/-?\\d+/;/*Match integer*/                returnreg.test (TXT);  Case 1: Reg=/^\d+ (\.\d+)? $/;/*matching non-negative floating-point numbers*/                returnreg.test (TXT);  Case 2: Reg=/^ (-?\d+) (\.\d+)? $/;/*matching floating-point numbers*/                returnreg.test (TXT);  Case 3: Reg=/^[a-za-z]+$/;/*Match 26 Letters of English*/                returnreg.test (TXT);  Case 4: Reg=/[\u4e00-\u9fa5]/;/*match Chinese characters*/                returnreg.test (TXT);  Case 5: Reg=/^[\w-]+ (\.[ \w-]+) *@[\w-]+ (\.[ \w-]+) +$/;/*Match Email address*/                returnreg.test (TXT);  Case 6: Reg=/^http:\/\/[a-za-z0-9]+\. [a-za-z0-9]+[\/=\?%\ -&_~ ' @[\]\':+!] * ([^<>\ "]) *$/;/* match URL url*/                returnreg.test (TXT);  Case 7: Reg= /^( -[0-9]{9})| ( -[0-9]{9})| ( -[0-9]{9})| ( the[0-9]{9})$/;/*Match Phone number*/                returnreg.test (TXT);  Case 8: Reg= /( -| ([1-9]? [0-9]?))%/;/*Match Percentage*/                returnreg.test (TXT);  Case 9: Reg=/^\w+$/;/*matches a string consisting of a number, 26 letters, or underscores*/                returnreg.test (TXT);  Case Ten: Reg= /^[0-9]*[1-9][0-9]*$/;/*match greater than 0 integers*/                returnreg.test (TXT);  Case  One: Reg= /^([0-1][0-9]| [2][0-3]):([0-5][0-9])$/;/*Match Time*/                returnreg.test (TXT);  Case  A: Reg= /(([0-9]{3}[1-9]| [0-9]{2}[1-9][0-9]{1}| [0-9]{1}[1-9][0-9]{2}| [1-9][0-9]{3})-(((0[13578]|1[ Geneva])-(0[1-9]| [ A][0-9]|3[ on]))| ((0[469]| One)-(0[1-9]| [ A][0-9]| -))| ( Geneva-(0[1-9]| [1][0-9]|2[0-8]))))| ((([0-9]{2})(0[ -]| [2468][048]| [13579][ -])| ((0[ -]| [2468][048]| [3579][ -])xx))- Geneva- in)/;/*Match Date*/                returnreg.test (TXT);  Case  -: Reg= /^[1-9]\d{0,3}$/;/*match a four-bit integer greater than 0*/                returnreg.test (TXT);  Case  -: Reg= /^[0-9]\d{0,7} (\.\d{1,2})?$/;/*match 2-bit decimals and 8-bit integers greater than 0*/                returnreg.test (TXT);  Case  the: Reg= /^[1-9]\d{0,8}$/;/*match a 9-bit integer greater than 0*/                returnreg.test (TXT);  Case  -: Reg=/&+/;/*Matching & Symbols*/                returnreg.test (TXT);  Case  -: Reg= /^[1-9]\d{0,4}$/;/*match a 5-bit integer greater than 0*/                returnreg.test (TXT);  Case  -: Reg= /^[0-9]\d{0,1} (\.\d{1,4})?$/;/*match 2 decimal places*/                returnreg.test (TXT);  Case  +: Reg= /^[1-9]\d*$/;/*match positive integers*/                returnreg.test (TXT);  Case  +: Reg=/^ (\d{ -}|\d{ -}) (\d| [XX]) $/;/*Match ID*/                returnreg.test (TXT); default:                return false; }}) (JQuery)

Validate.plugin.js Verification Plugin

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