在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
IP validates_format_of :ip, :with => /^((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$/ reg = /^((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$/
validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, :if => :email?
(function($){ $.fn.validationEngineLanguage = function(){ }; $.validationEngineLanguage = { newLang: function(){ //Some regular expressions were append "|^$", to avoid different error messages popup in the same time. FuYM $.validationEngineLanguage.allRules = { "required": { // Add your regex rules here, you can take telephone as an example "regex": "none", "alertText": "* 不能为空", "alertTextCheckboxMultiple": "* 请选择一个项目", "alertTextCheckboxe": "* 您必需勾选此栏位", "alertTextDateRange": "* 日期范不能为空" }, "dateRange": { "regex": "none", "alertText": "* 无效的 ", "alertText2": " 日期范围" }, "compareDate": { "regex": "none", "alertText": "* 起始日期大于截止日期 " }, "dateInRange": { "regex": "none", "alertText": "* 无效的日期范围", "alertText2": "* 无效的日期" }, "dateTimeRange": { "regex": "none", "alertText": "* 无效的 ", "alertText2": " 时间范围" }, "minSize": { "regex": "none", "alertText": "* 最少 ", "alertText2": " 个字符" }, "maxSize": { "regex": "none", "alertText": "* 最多 ", "alertText2": " 个字符" }, "groupRequired": { "regex": "none", "alertText": "* 您必需选填其中一个栏位" }, "min": { "regex": "none", "alertText": "* 最小值为 " }, "max": { "regex": "none", "alertText": "* 最大值为 " }, "past": { "regex": "none", "alertText": "* 日期必需早于 " }, "future": { "regex": "none", "alertText": "* 日期必需晚于 " }, "maxCheckbox": { "regex": "none", "alertText": "* 最多选取 ", "alertText2": " 个项目" }, "minCheckbox": { "regex": "none", "alertText": "* 请选取 ", "alertText2": " 个项目" }, "equals": { "regex": "none", "alertText": "* 栏位內容不相符" }, "phone": { // credit: jquery.h5validate.js / orefalo "regex": /^(\d{3,4}-)?\d{7,8}(-\d{1,})?$/, /** /^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$|^$/,**/ "alertText": "* 无效的电话号码,格式应为:区号-固话号码-分机号" }, "phone1": { // credit: jquery.h5validate.js / orefalo 电话号中间可以有“-” 也可以没有 "regex": /^(\d{3,4}-*)?\d{7,8}(-*\d{1,})?$/, /** /^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$|^$/,**/ "alertText": "* 无效的电话号码" }, "mobile": { "regex": /^\d{11,12}?$/, "alertText": "* 无效的手机号码,格式应为:11位或12位数字" }, "referer": { "regex": /^[@._a-zA-Z0-9\u4e00-\u9fa5]{0,30}$/, "alertText": "* 推荐人信息应为30位以内的汉字、数字、字母、@、点号以及下划线组成" }, "email": { // Shamelessly lifted from Scott Gonzalez via the Bassistance Validation plugin http://projects.scottsplayground.com/email_address_validation/ "regex": /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$|^$/i, "alertText": "* email 地址不合法" }, "integer": { "regex": /^[\-\+]?\d+$/, "alertText": "* 不是有效的整數". }, "number": { // Number, including positive, negative, and floating decimal. credit: orefalo "regex": /^[\-\+]?(([0-9]+)([\.,]([0-9]+))?|([\.,]([0-9]+))?)$/, "alertText": "* 无效的數字" }, "date": { "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$|^$/, "alertText": "* 无效的日期,格式必需为 YYYY-MM-DD" }, "ipv4": { "regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/, "alertText": "* 无效的 IP 位址" }, "url": { "regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i, "alertText": "* 非法的 URL" }, "onlyNumberSp": { "regex": /^[0-9\ ]+$|^$/, "alertText": "* 只能填數字" }, "onlyLetterSp": { "regex": /^[a-zA-Z\ \']+$|^$/, "alertText": "* 只接受英文字母大小寫" }, "onlyLetterNumber": { "regex": /^[0-9a-zA-Z]+$|^$/, "alertText": "* 不接受特殊字元" }, // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings "ajaxUserCall": { "url": "ajaxValidateFieldUser", // you may want to pass extra data on the ajax call "extraData": "name=eric", "alertText": "* 此名称已经被其他人使用", "alertTextLoad": "* 正在确认名称是否有其他人使用,请稍等。" }, "ajaxUserCallPhp": { "url": "phpajax/ajaxValidateFieldUser.php", // you may want to pass extra data on the ajax call "extraData": "name=eric", // if you provide an "alertTextOk", it will show as a green prompt when the field validates "alertTextOk": "* 此账号名称可以使用", "alertText": "* 此账号名称已经被其他人使用", "alertTextLoad": "* 正在确认账号名称是否有其他人使用,请稍等。" }, "ajaxNameCall": { // remote json service location "url": "ajaxValidateFieldName", // error "alertText": "* 此名称可以使用", // if you provide an "alertTextOk", it will show as a green prompt when the field validates "alertTextOk": "* 此名称已經被其他人使用", // speaks by itself "alertTextLoad": "* 正在确认名称是否有其他人使用,请稍等。" }, "ajaxNameCallPhp": { // remote json service location "url": "phpajax/ajaxValidateFieldName.php", // error "alertText": "* 此名称已经被其他人使用", // speaks by itself "alertTextLoad": "* 正在确认名称是否有其他人使用,请稍等。" }, "validate2fields": { "alertText": "* 请输入 HELLO" }, //tls warning:homegrown not fielded "dateFormat":{ "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(0?2(\/|-)29)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/, "alertText": "* 无效的日期格式" }, //tls warning:homegrown not fielded "dateTimeFormat": { "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1}$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^((1[012]|0?[1-9]){1}\/(0?[1-9]|[12][0-9]|3[01]){1}\/\d{2,4}\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1})$/, "alertText": "* 无效的日期或时间格式", "alertText2": "可接受的格式: ", "alertText3": "mm/dd/yyyy hh:mm:ss AM|PM 或 ", "alertText4": "yyyy-mm-dd hh:mm:ss AM|PM" }, //Rules below here were defined by ourself, FuYM "lengthRange":{ "regex":"none", "alertText":"* 长度为 ", "alertText2":" 到 ", "alertText3": " 个字符" }, "codeLength":{ "regex":"none", "alertText":"* 长度必需", "alertText2": " 个字符" }, "cardNo":{ "regex":/(^[0-9\ ]+$)|^$/, "alertText":"* 账号只能输入数字" }, "onlyNumber":{ "regex":/(^[0-9]+$)|^$/, "alertText":"* 只能输入数字" }, "onlyLetter":{ "regex":/(^[a-zA-Z]+$)|^$/, "alertText":"* 只能输入字母" }, "numOrletter":{ "regex":/(^[a-zA-Z0-9]+$)|^$/, "alertText":"* 只能输入数字或字母" }, "numAndLetter":{ "regex":/(^(([a-zA-Z]+[0-9]+)|([0-9]+[a-zA-Z]+))[a-zA-Z0-9]*$)|^$/, "alertText":"* 必须为数字和字母的组合" }, "number2":{ "regex":/(^(([1-9]+[0-9]*(\.\d{1,2})?)|0|(0\.\d{1,2}))$)|^$/, "alertText":"* 只能输入数字,可带两位小数" }, "keyboard":{ "regex":"none", "alertText":"* 不能为空", "alertText2":"* 长度应为", "alertText3": " 个字符" }, "cardMonth":{ "regex":"none", "alertText1":"* 不能为空", "alertText2":"* 只能是2位数字", "alertText3":"* 月份输入不合法" }, "numOrLetterOrUnderline":{ "regex":/(^[a-zA-Z0-9\_]+$)|^$/, "alertText":"* 只能输入数字或字母或下划线" }, "numOrLetterOrDot":{ "regex":/(^[a-zA-Z0-9\.]+$)|^$/, "alertText":"* 只能输入数字或字母或点" }, //Same as "equals", used in last version "confirm":{ "regex":"none", "alertText":"* 两次输入不一致" }, "moneyCompare":{ "regex":"none", "alertText":"* 最小金额大于最大金额" }, "simplePwd":{ "regex":/^((?!\b000000\b|\b111111\b|\b222222\b|\b333333\b|\b444444\b|\b555555\b|\b666666\b|\b777777\b|\b888888\b|\b999999\b|\b012345\b|\b123456\b|\b234567\b|\b345678\b|\b456789\b|\b987654\b|\b876543\b|\b765432\b|\b654321\b|\b543210\b).)*$/, "alertText":"* 您的密码过于简单,请到柜面或ATM上修改后再操作;e卡客户可通过网银服务管理-密码修改功能下直接修改;信用卡客户可通过信用卡登录-密码管理功能下直接修改。" } }; } }; $.validationEngineLanguage.newLang(); })(jQuery);
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论