匹配 username
1 | /^[a-z0-9_-\u4E00-\u9FA5\uf900-\ufa2d]{3,16}$/ |
匹配 password
1 | /^[a-z0-9_-]{6,18}$/ |
匹配 ID card
1 | /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{4}$/ |
匹配 cellphone
1 | /^1[3-9](\d{9})$/ |
匹配 hex value
1 | /^#?([a-f0-9]{6}|[a-f0-9]{3})$/ |
匹配 slug
1 | /^[a-z0-9-]+$/ |
注:详情见: slug
匹配 email
1 | /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/ |
匹配 URL
1 | /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/ |
匹配 IP Address
1 | /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/ |
有问题?发送 issues 给我~