修改QQ正则并增加URL正则

This commit is contained in:
MrTenger 2019-06-28 09:38:04 +08:00
parent 7319994949
commit b984b646ee
4 changed files with 12270 additions and 71 deletions

View File

@ -2,6 +2,9 @@
查询界面:
https://any86.github.io/any-rule/
## URL正则
```/^((https?|ftp|file):\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/```
## 手机号
```/^1((3[\d])|(4[5,6,9])|(5[0-3,5-9])|(6[5-7])|(7[0-8])|(8[1-3,5-8])|(9[1,8,9]))\d{8}$/```

12167
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -39,7 +39,7 @@
<ul v-if="0 < rules.length" class="list">
<li
@mouseenter="mouseenterHandler(index)"
v-for="({title, rule, events}, index) in rules"
v-for="({title, rule, example, events}, index) in rules"
:key="title"
class="row"
>
@ -55,6 +55,7 @@
<input
ref="input"
v-model="list[index].value"
:placeholder="example"
@blur="check(index, 'blur')"
@keyup="check(index, 'keyup')"
>

View File

@ -1,99 +1,127 @@
module.exports = [{
module.exports = [
{
title: 'URL正则',
rule: /^((https?|ftp|file):\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})(\/\w\.-]*)*\/?$/,
example: '如: www.qq.com 、file:///C:/Users/KD/index.js'
},
{
title: '手机号',
rule: /^1((3[\d])|(4[5,6,9])|(5[0-3,5-9])|(6[5-7])|(7[0-8])|(8[1-3,5-8])|(9[1,8,9]))\d{8}$/,
}, {
example: '如: 18311006933、17888829981'
},
{
title: '大写字母',
rule: /^[A-Z]+$/,
}, {
example: '如: ABC、KD'
},
{
title: '日期,如: 2000-01-01',
rule: /^\d{4}(-)\d{1,2}\1\d{1,2}$/,
}, {
example: '如: 1990-12-12、2020-01-01'
},
{
title: 'email地址',
rule: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
}, {
example: '如: 90203918@qq.com、nbilly@126.com'
},
{
title: '国内座机电话,如: 0341-86091234',
rule: /\d{3}-\d{8}|\d{4}-\d{7}/,
},
{
example: '如: 0936-4211235'
},
{
title: '身份证号(15位、18位数字)最后一位是校验位可能为数字或字符X',
rule: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
},
{
example: '如: 622223199912051311'
},
{
title: '帐号是否合法(字母开头允许5-16字节允许字母数字下划线组合',
rule: /^[a-zA-Z][a-zA-Z0-9_]{4,15}$/
},
{
rule: /^[a-zA-Z][a-zA-Z0-9_]{4,15}$/,
example: '如: justin、justin1989、justin_666'
},
{
title: '只包含中文',
rule: /^[\u4E00-\u9FA5]/
},
{
rule: /^[\u4E00-\u9FA5]/,
example: '如: 正则、前端'
},
{
title: '是否小数',
rule: /^\d+\.\d+$/
},
{
rule: /^\d+\.\d+$/,
example: '如: 0.0、0.09'
},
{
title: '是否电话格式(手机和座机)',
rule: /^((0\d{2,3}-\d{7,8})|(1[345789]\d{9}))$/
},
{
rule: /^((0\d{2,3}-\d{7,8})|(1[345789]\d{9}))$/,
example: '如: 0936-4211236、19888978261'
},
{
title: '是否8位纯数字',
rule: /^[0-9]{8}$/
},
{
rule: /^[0-9]{8}$/,
example: '如: 12345678'
},
{
title: '是否html标签',
rule: /<(.*)>.*<\/\1>|<(.*) \/>/
},
{
rule: /<(.*)>.*<\/\1>|<(.*) \/>/,
example: '如: <div> </div>'
},
{
title: '是否qq号格式正确',
rule: /^[1-9]*[1-9][0-9]*$/
},
{
rule: /^[1-9][0-9]{4,10}$/,
example: '如: 903013545、9020304'
},
{
title: '是否由数字和字母组成',
rule: /^[A-Za-z0-9]+$/
},
{
rule: /^[A-Za-z0-9]+$/,
example: '如: james666、haha233hi'
},
{
title: '是否小写字母组成',
rule: /^[a-z]+$/
},
{
rule: /^[a-z]+$/,
example: '如: russel'
},
{
title: '密码强度正则最少6位包括至少1个大写字母1个小写字母1个数字1个特殊字符',
rule: /^.*(?=.{6,})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*? ]).*$/
},
{
rule: /^.*(?=.{6,})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*? ]).*$/,
example: '如: Kd@curry666'
},
{
title: '用户名正则4到16位字母数字下划线减号',
rule: /^[a-zA-Z0-9_-]{4,16}$/
},
{
rule: /^[a-zA-Z0-9_-]{4,16}$/,
example: '如: xiaohua_qq'
},
{
title: 'ipv4地址正则',
rule: /^(?:(?: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]?)$/
},
{
rule: /^(?:(?: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]?)$/,
example: '如: 172.16.0.0、127.0.0.0'
},
{
title: '16进制颜色',
rule: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/
},
{
rule: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,
example: '如: #f00 、#F90、#000、 #fe9de8'
},
{
title: '微信号6至20位以字母开头字母数字减号下划线',
rule: /^[a-zA-Z]([-_a-zA-Z0-9]{5,19})+$/
},
{ title: '车牌号正则', rule: /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/ },
{ title: '中国邮政编码', rule: /^(0[1-7]|1[0-356]|2[0-7]|3[0-6]|4[0-7]|5[1-7]|6[1-7]|7[0-5]|8[013-6])\d{4}$/ },
{
rule: /^[a-zA-Z]([-_a-zA-Z0-9]{5,19})+$/,
example: '如: github666、kd_-666'
},
{
title: '车牌号正则',
rule: /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/,
example: '如: 京A00599、黑D23908'
},
{
title: '中国邮政编码',
rule: /^(0[1-7]|1[0-356]|2[0-7]|3[0-6]|4[0-7]|5[1-7]|6[1-7]|7[0-5]|8[013-6])\d{4}$/,
example: '如: 734500、100101'
},
{
title: '只包含中文和数字',
rule: /^(([\u4E00-\u9FA5])|(\d))+$/
},
{
rule: /^(([\u4E00-\u9FA5])|(\d))+$/,
example: '如: 哈哈哈、你好6啊'
},
{
title: '非字母',
rule: /[^A-Za-z]/
}
rule: /[^A-Za-z]/,
example: '如: 你好6啊、Q3Q、ABC@¥()'
}
];