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
|
// 域名正则式
const
URLRULE =
'/^http[s]?:\/\/(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-z_!~*\'()-]+\.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\.[a-z]{2,6})(:[0-9]{1,4})?((\/\?)|(\/[0-9a-zA-Z_!~\*\'\(\)\.;\?:@&=\+\$,%#-\/]*)?)$/'
;
//固定号码
const
TELEPARSE =
'/^[048]\d{2,3}-?\d{3,4}-?\d{3,4}(-\d{1,})?$/'
;
//手机号码
const
MOBILEPARSE =
'/^(\+?86-?)?(18|17|15|13)[0-9]{9}$/'
;
//电话号码
const
PHOTOPARSE =
'/(^(\+?86-?)?(18|17|15|14|13)[0-9]{9}$)|(^[048]\d{2,3}-?\d{3,4}-?\d{3,4}(-\d{1,})?$)/'
;
//时间格式
const
DATERULE =
'/^\\d{4}[-](0?[1-9]|1[012])[-](0?[1-9]|[12][0-9]|3[01])(\s+(0?[0-9]|[12][0-3]):(0?[0-9]|[1-5][1-9]):(0?[0-9]|[1-5][1-9]))?$/'
;
//邮箱地址
const
MAILPARSE =
'/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/i'
;
//浮点数
const
FLOAT =
'/^\\d+(\\.\\d+)?$/'
;
//最多只能有两位小数
const
TWODECIMAL =
'/^\\d+(\\.\\d{0,2}+)?$/'
;
//数字
const
INTEGER =
'/^[0-9]*$/'
;
//"2090009973,2089948681"
const
SPLIT_INTEGER =
'/^(\d[,]?)*$/'
;
//无特殊字符
const
CHINESE =
'/^[\x{4e00}-\x{9fa5} A-Za-z0-9\-_\*\!\@\#\%\&\(\)\,\.]+$/u'
;
//只能是0或者1
const
ZORE_OR_ONE =
'/^[0|1]*$/'
;
//连续出现两个{
const
CONTINUOUS_BRACE =
"/({[^{^}]+}\s*){2}/"
;
//四个{}
const
THREE_BRACE =
"/(.*{.*}.+){4,}/"
;
|
版权声明:原创作品,如需转载,请注明出处。否则将追究法律责任
本文转自 梦朝思夕 51CTO博客,原文链接:http://blog.51cto.com/qiangmzsx/1597478