1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| var regex = window.regex || (function (document, $) { var _reg = {}; $.extend(_reg, { 'num': /^\d+$/, 'znum': /^[1-9](\d+)?$/, 'float': /^[-]{0,1}(\d+)[\.]+(\d+)$/, 'money': /^\d{1,12}(?:\.\d{1,3})?$/, 'idCard': /^\d{15}$|^\d{18}$|^\d{17}[xX]$/, 'idCardStrict':/^(\d{6})([1-2])(\d{3})((?:0[1-9])|(?:1[0-2]))((?:0[0-9])|(?:[1-2][0-9])|(?:3[0-1]))(\d{3})(\d{1})$/, 'qq': /^[1-9]\d{4,15}$/, 'pwd': /^[\@A-Za-z0-9]{6,16}$/, 'areacode': /^(0[1,2]{1}\d{1})$|^(0[3-9]{1}\d{2})$/, 'tel': /^\d{7,8}$/, 'mobile': /^((\+86)|(\(\+86\)))?-?(13|14|15|18|17)[0-9]{9}$/, 'telephone': /^(((\+)?86)|(\(\+86\)))?-?((((0)?[1,2]{1}\d{1})?-?\d{8})|((0[3-9]{1}\d{2})?-?\d{7,12}))-?(\d{1,8})?$/, 'phone': /^((\+86)|(\(\+86\)))?-?(13|14|15|18|17)[0-9]{9}$|^((\+86)|(\(\+86\)))?-?(((0[1,2]{1}\d{1})?-?\d{8})|((0[3-9]{1}\d{2})?-?\d{7,8}))$/, 'zipcode': /^\d{6}$/ }); $.extend(_reg, { 'email': /^\w{1,16}([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/, 'chinese': /^[\u4E00-\u9FA5]+$/, 'char': /^[A-Za-z]+$/, 'charn': /^[A-Za-z0-9]+$/, 'nospecial': /^[\u4E00-\u9FA5A-Za-z0-9]+$/, 'url': /^((http|https|ftp):\/\/)?(\w(\:\w)?@)?([0-9a-z_-]+\.)*?([a-z0-9-]+\.[a-z]{2,6}(\.[a-z]{2})?(\:[0-9]{2,6})?)((\/[^?#<>\/\\*":]*)+(\?[^#]*)?(#.*)?)?$/, 'loginName': /^(13|14|15|18|17)[0-9]{9}$|^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/, 'userName': /^[\u4e00-\u9fa5]{2`,4}$|[a-zA-Z]{4,20}$/, 'nickName': /^([a-zA-Z\u4e00-\u9fa5]{1}[a-zA-Z0-9_\u4e00-\u9fa5]{3,19})$/ }); return _reg; })(document, window.jQuery); window.regex = regex;
|