js正则表达式总结
1、require: /.+/,
2、username: /^[\u4E00-\u9FA5A-Za-z0-9_\ ]{3,20}$/i,
3、password: /^[a-zA-Z0-9\_\-\~\!\%\*\@\#\$\&\.\(\)\[\]\{\}\<\>\?\\\/\’\”]{3,20}$/,
4、number: /^\d+$/,
5、money: /^(([1-9]\d*)|(([0-9]{1}|[1-9]+)\.[0-9]{1,2}))$/,
6、per: /^(?:[1-9][0-9]?|100)(?:\.[0-9]{1,2})?$/,
7、email: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
8、phone: /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/,
9、mobile: /^((\(\d{2,3}\))|(\d{3}\-))?((13\d{9})|(15[35890]\d{8})|(186\d{8}))$/,
10、url: /^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\’:+!]*([^<>\"])*$/,
11、
ip:
/^(0|[1-9]\d?|[0-1]\d{2}|2[0-4]\d|25[0-5]).(0|[1-9]\d?|[0-1]\d{2}|2[0-4]\d|25[0-5]).(0|[1-9]\d?|[0-1]\d{2}|2[0-4]\d|25[0-5]).(0|[1-9]\d?|[0-1]\d{2}|2[0-4]\d|25[0-5])$/,
12、currency: /^\d+(\.\d+)?$/,
13、zip: /^[1-9]\d{5}$/,
14、qq: /^[1-9]\d{4,8}$/,
15、english: /^[A-Za-z]+$/,
16、chinese: /^[\u0391-\uFFE5]+$/,
17、integer: /^[-\+]?\d+$/,
18、'double': /^[-\+]?\d+(\.\d+)?$/,
19、
idcard:
/(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3})|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])(\d{4}|\d{3}[x]))$/