Self-organizing a few jquery. Validate Verify the Regular:
1. Enter only numbers and letters /^[0-9a-za-z]*$/g
JQuery.validator.addMethod ("Letters", function (value, Element) { return this.optional (Element) | |/^[0-9a-za-z]* $/g.test (value);}, "Only enter numbers and letters!");
2. The quantity must be a positive integer /^\+?[ 1-9]\d*$/
JQuery.validator.addMethod ("Count", function (value, Element) { return this.optional (Element) | |/^\+?[ 1-9]\d*$/.test (value);}, "Quantity must be a positive integer!");
3. Only non-negative integer/^ can be entered ([1-9]\d*|[ 0]) $/
function (value, Element) { returnthis. Optional (Element) | |/^ ([1-9]\d*|[ 0]) $/"can only enter non-negative integers!");
4. date is YYYY-MM-DD format! /^ (\d{4})-(\d{2})-(\d{2}) $/
function (value, Element) { returnthis. Optional (Element) | |/^ (\D{4})-(\d{2})-(\d{2}) $/ "date is YYYY-MM-DD format!");
5. the temperature is 100.00 to 100.00 /^-? \d| [1-9]\d|100] (\.\d{1,2})? $/
function (value, Element) { returnthis. Optional (Element) | |/^-? ( \d| [1-9]\d|100] (\.\d{1,2})? $/"Temperature is 100.00 to 100.00");
6. Humidity of 0 to 100.00 /^ (\d|[ 1-9]\d|100) (\.\d{1,2})? $/
function (value, Element) { returnthis. Optional (Element) | |/^ (\d|[ 1-9]\d|100) (\.\d{1,2})? $/"humidity of 0 to 100.00");
7. Please enter an integer greater than 0 or retain three decimal places
function (value, Element) { // Enter an integer greater than 0 or leave the three-bit decimal returnthis. Optional ( Element) | | /(^[1-9]{1}[0-9]*$) | (^[0-9]*\. [0-9] {3}$)/"Invoice amount shall not be less than or equal to 0");
8. Invoice number contains numbers,-,/three characters, no spaces
function (value, Element) { returnthis. Optional (Element) | |/^[-/0-9]*$/.test (value);} , "Please enter a valid invoice number");
Self-organizing jquery. Validate Validation expressions