여러 전단 에서 검 증 된 정규 표현 식

2304 단어
정규 표현 식
/*********************************
* Themes, rules, and i18n support
* Locale: Chinese;    
*********************************/
(function (factory) {
if (typeof define === 'function') {
define(function (require, exports, module) {
var $ = require('jquery');
$._VALIDATOR_URI = module.uri;
require('../src/jquery.validator')($);
factory($);
});
} else {
factory(jQuery);
}
}(function ($) {
/* Global configuration
*/
$.validator.config({
//stopOnError: false,
//theme: 'yellow_right',
defaultMsg: "{0}     ",
loadingMsg: "    ...",

// Custom rules
rules: {
digits: [/^\d+$/, "     "],
recomTag: [/^[A-Za-z0-9]+$/, "        "],
recomAmount: [/^[1-9]|[1-9]\d+$/, "     ,   0"],
letters: [/^[a-z]+$/i, "{0}      "],
tel: [/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/, "       "],
mobile: [/^1[3-9]\d{9}$/, "        ", "           "],
email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "       ", "          "],
qq: [/^[1-9]\d{4,}$/, "QQ      "],
date: [/^\d{4}-\d{1,2}-\d{1,2}$/, "        , :yyyy-mm-dd"],
time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "        , :14:30 14:30:00"],
time1: [/^([01]{0,1}\d|2[0-3])(:[0-5]\d){1,2}$/, "    :14:30"],
ID_card: [/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[A-Z])$/, "           "],
url3: [/^((http:\/\/)|(https:\/\/))?([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z0-9]{2,6}(:[0-9]+)?$/i, "          "],
url: [/^(https?|ftp|http):\/\/[^\s]+$/i, "          "],
url5: [/^(https|ftp|http):\/\/.+$/i, "          "],
url2: [/^((http:\/\/)|(https:\/\/))?([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$/i, "          "],
url1: [/^(https?|ftp|http):\/\/[^\s]+|([a-zA-Z\d][a-zA-Z\d-_]+\.)+[a-zA-Z\d-_][^ ]*$/, "        "],
url4: [/^((http:\/\/)|(https:\/\/))?([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+(cn|cx|co|cn|wang|cc|xin|com|net|top|tech|org|red|pub|ink|info|xyz|win|edu|[0-9]{2,6})(:[0-9]{1,6})?([\/]\S*)*$/, '          '],
postcode: [/^[1-9]\d{5}$/, "         "],
positive: [/^\d+(.\d{1,2})?$/, "     "],

좋은 웹페이지 즐겨찾기