Compare commits

...

167 Commits

Author SHA1 Message Date
Russell
43abe0f895 perf: 手机号段增加192/6/7(#299)(#300) 2023-11-30 08:57:37 +08:00
Russell
f304ddf19d docs: 更新文档 2023-08-30 09:14:50 +08:00
Russell
912f29e3f3 fix: 更换新能源车牌正则(#281) 2023-08-30 09:14:23 +08:00
铁皮饭盒
f6f93753d2
Merge pull request #274 from thelostword/hexcolor/patch-1
fix: 修复16进制颜色无法匹配带 alpha 值的问题
2022-11-30 16:14:06 +08:00
losting
3b5a440413
Update RULES.js 2022-11-25 14:16:10 +08:00
losting
0c5bb2c90d
Update README.md 2022-11-25 14:14:43 +08:00
losting
583c72361a
Update RULES.js 2022-11-23 12:34:01 +08:00
losting
92f50702aa
Update README.md 2022-11-23 12:33:28 +08:00
thelostword
e62146d1c6 fix: 修复16进制颜色无法匹配带 alpha 值的问题
fix #273
2022-11-23 12:21:08 +08:00
铁皮饭盒
65a2282e82
Merge pull request #270 from q310550690/master
update:网页搜索吸顶
2022-11-07 14:53:39 +08:00
诗小柒
2fec6044a4 update:网页搜索吸顶 2022-11-07 14:32:36 +08:00
Russell
07cad47994 0.3.18 2022-11-07 12:05:50 +08:00
Russell
a35be80cc5 更新日志 2022-11-07 12:03:19 +08:00
Russell
5acc409192 0.3.17 2022-11-07 11:53:21 +08:00
Russell
3c2da62cb7 v0.3.16 2022-11-07 11:52:18 +08:00
Russell
977f357110 perf: 数字/货币金额(支持负数、千分位分隔符)(#238) 2022-11-07 11:47:07 +08:00
Russell
c3d49bdba5 perf: 小数(支持科学计数)(#234) 2022-11-07 11:43:10 +08:00
Russell
2cd6b6935f perf: 缩短"用户名校验"正则长度(#245) 2022-11-07 11:36:43 +08:00
Russell
bd26e0f450 fix: MAC地址的第二位一定是偶数(#264) 2022-11-07 11:34:02 +08:00
Russell
c0b38192b0 perf: 增加户口薄正则 2022-11-07 11:21:16 +08:00
Russell
ec0b032fb8 perf: 增加军官证正则 2022-11-07 11:19:45 +08:00
Russell
0be115a81f Merge branch 'master' into develop 2022-09-01 10:17:39 +08:00
Russell
c77249d98a docs: 更新demo地址 2022-09-01 10:07:27 +08:00
Russell
7913203e44 chore: demo移动到vercel 2022-09-01 10:06:40 +08:00
Russell
152c015f7d chore: 修改demo的打包路径 2022-09-01 10:02:16 +08:00
Russell
a9100ebe20 fix: 整数包含0(#263) 2022-09-01 09:45:42 +08:00
Russell
f36ebbde10 chore: 更新文档 2022-07-20 11:22:11 +08:00
Russell
877ff94622 0.3.15 2022-07-20 11:21:39 +08:00
Russell
32db74a841 docs: 更新文档 2022-07-20 11:20:29 +08:00
Russell
f762c31942 feat: 新增"域名"正则(#232) 2022-07-20 09:28:57 +08:00
Russell
a2a28b8dec chore: 删除npm的lock(#244) 2022-07-20 09:23:26 +08:00
Russell
765a8a2dc6 Merge branch 'master' of https://github.com/any86/any-rule 2022-07-20 09:08:27 +08:00
Russell
37a6d1e457 perf: 优化MD5正则的长度(#256) 2022-07-20 09:08:23 +08:00
铁皮饭盒
2304e724d7
Merge pull request #236 from trentlee0/master
添加 uTools 版链接地址
2022-07-20 09:06:40 +08:00
any86
96cb8eff89 fix: 支持195号段(#240) 2022-05-29 19:24:29 +08:00
Trent Lee
8064470b71 docs: 添加 uTools 版链接地址 2022-05-20 16:11:16 +08:00
Russell
508b202424 docs: 更新文档 2022-04-18 11:12:26 +08:00
Russell
39085bbd42 0.3.14 2022-04-18 11:11:22 +08:00
Russell
a6248d7208 feat: 新增"中国省"(#227) 2022-04-18 11:10:45 +08:00
Russell
86f2392d39 feat: 新增"日期(严谨, 支持闰年判断)"(#226) 2022-04-18 11:09:06 +08:00
Russell
574bbf8d8e feat: 新增"匹配中文汉字和中文标点" 2022-04-18 11:04:57 +08:00
铁皮饭盒
8337d819f5
Merge pull request #224 from heshimang/develop
feat: 添加车架号正则
2022-03-22 10:45:36 +08:00
heshimang
a4794f509c feat: 添加车架号正则 2022-03-22 09:48:49 +08:00
铁皮饭盒
c4b961531c
Merge pull request #222 from DiracKeeko/modify_dev
Modify dev
2022-03-11 20:01:38 +08:00
Keeko
39143127bc [feat] 新增 ASCII码表中的全部的特殊字符 正则 2022-03-11 17:10:02 +08:00
Keeko
5782ee1ddc [feat] 新增 浮点数(严格) 正则 2022-03-11 17:03:36 +08:00
Keeko
03471b0036 [feat] 更新浮点数逻辑 2022-03-11 16:51:55 +08:00
Keeko
043137e964 [fix] 修复整数逻辑, ban "022", allow "22" 2022-03-11 16:30:39 +08:00
铁皮饭盒
d71e412375
Update README.md 2022-02-22 17:39:20 +08:00
Russell
7601b3fc2a docs: 更新文档, 加入hyjs链接 2022-01-11 10:32:12 +08:00
Russell
2f86730484 fix: v0.3.13(#175, #207, #210, #215) 2022-01-10 13:35:23 +08:00
Russell
566f079bf8 0.3.13 2022-01-10 13:26:06 +08:00
Russell
21f94dfe65 chore: 更新依赖, 支持node16 2022-01-10 13:23:41 +08:00
铁皮饭盒
594175b638
Merge pull request #198 from any86/dependabot/npm_and_yarn/packages/www/color-string-1.6.0
chore(deps): bump color-string from 1.5.3 to 1.6.0 in /packages/www
2021-12-21 08:55:46 +08:00
Russell
e18baa40e5 chore: 更新circle ci中node镜像的版本 2021-12-20 15:41:06 +08:00
Russell
be1a8c73b3 chore(build): 更新文档脚本中gif图 2021-12-20 15:09:23 +08:00
Russell
cfc0ce47c4 docs: 更新文档 2021-12-20 14:40:12 +08:00
铁皮饭盒
22e14efe14
Merge pull request #209 from 2462870727/develop
fix 子网掩码正则错误问题
2021-12-20 14:39:16 +08:00
铁皮饭盒
ba3213aa54
Merge branch 'develop' into develop 2021-12-20 14:39:08 +08:00
铁皮饭盒
f159ef301f
Merge pull request #176 from FE-ng/dev_momentTimeRule_lf
添加了能够被moment正确转化的正则
2021-12-20 14:38:11 +08:00
铁皮饭盒
113abe7aa7
Merge branch 'develop' into dev_momentTimeRule_lf 2021-12-20 14:38:04 +08:00
Russell
77509e77e6 test: 增加测试用例(#207) 2021-12-20 14:23:14 +08:00
Russell
86b6af24c9 fix: 修正"澳门身份证"(#210) 2021-12-20 14:19:18 +08:00
Russell
8280758a03 fix: 参考百度百科和"chrome地址栏", 修改URL的验证规则(#175) 2021-12-20 11:30:37 +08:00
jiangkai@flksec.com
9690773b33 fix 子网掩码正则错误问题 2021-11-19 10:47:37 +08:00
Russell
57ef9be087 perf: 优化ipv6正则(#189) 2021-10-29 10:29:43 +08:00
any86
35256d81dd chore: 修改json格式错误 2021-10-20 22:43:58 +08:00
any86
ffc748695f
Merge pull request #204 from 2462870727/master
# 223
2021-10-20 22:39:46 +08:00
any86
4fafde7efc
Merge branch 'develop' into master 2021-10-20 22:39:20 +08:00
2462870727@qq.com
89083d14a6 update 复杂密码校验 2021-10-20 21:15:46 +08:00
xiaocaiji
7a0d7a32a9
Update RULES.js 2021-10-20 17:47:15 +08:00
xiaocaiji
f419267072
Update README.md 2021-10-20 17:05:33 +08:00
xiaocaiji
aff19cbcab
Update README.md 2021-10-20 17:04:50 +08:00
xiaocaiji
d9b00b4483
Update RULES.js 2021-10-20 17:04:14 +08:00
xiaocaiji
cd141a9472
Update README.md 2021-10-20 17:02:08 +08:00
xiaocaiji
26220db48a
Update RULES.js 2021-10-20 16:57:24 +08:00
Russell
8414a8e1aa docs: 更新文档 2021-10-20 11:21:51 +08:00
Russell
a499d000ad 0.3.12 2021-10-20 11:18:35 +08:00
Russell
1ca32353d4 chore:更新日志 2021-10-20 11:10:05 +08:00
Russell
36236a6d04 Merge branch 'develop' 2021-10-20 11:08:29 +08:00
Russell
4710be9ba9 fix: 解决网址不能带"()"(#202) 2021-10-20 11:05:44 +08:00
Russell
89444b29e8 Merge branch 'master' of https://github.com/any86/any-rule 2021-10-20 10:06:57 +08:00
any86
8fd08708dc
Merge pull request #201 from songjianet/develop-number
feat: Increase number-related regular verification
2021-10-20 10:05:39 +08:00
songjian
44b733569e feat: add cEmail 2021-10-19 11:09:37 +08:00
songjian
df9a5ac291 feat: Increase number-related regular verification 2021-10-13 16:12:45 +08:00
songjian
e0fcb8259b feat: Increase number-related regular verification 2021-10-12 17:48:26 +08:00
any86
7807af68b7 refactor: 修改web版本按钮样式 2021-10-01 20:26:01 +08:00
Russell
9b913b643b Merge branch 'master' of https://github.com/any86/any-rule 2021-09-28 16:54:29 +08:00
383514580
9873f5db00 v0.3.11 2021-09-27 21:01:10 +08:00
Russell
1283e87859 v0.3.11 2021-09-26 14:50:42 +08:00
Russell
ec9371016a 0.3.11 2021-09-26 14:50:07 +08:00
Russell
f83922b363 更新日志 2021-09-26 14:33:10 +08:00
Russell
7d52471fd9 perf: 身份证严格校验,包含年份、月份的校验,支持15,18位身份证(#190) 2021-09-26 14:31:17 +08:00
dependabot[bot]
2b5758a98d
chore(deps): bump color-string from 1.5.3 to 1.6.0 in /packages/www
Bumps [color-string](https://github.com/Qix-/color-string) from 1.5.3 to 1.6.0.
- [Release notes](https://github.com/Qix-/color-string/releases)
- [Changelog](https://github.com/Qix-/color-string/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Qix-/color-string/commits/1.6.0)

---
updated-dependencies:
- dependency-name: color-string
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-26 06:11:06 +00:00
Russell
5f3887343a fix: 修复新版vocode中"@zz"不能唤起的BUG(#195) 2021-09-26 14:09:17 +08:00
any86
80f68ddec7
Create LICENSE 2021-09-07 17:20:02 +08:00
any86
9c322ba759
Merge pull request #184 from chenguzhen87/master
html注释正则修改
2021-07-23 15:27:14 +08:00
精武陈真
75a7848934
Update README.md 2021-07-23 12:01:48 +08:00
精武陈真
22e69a9220
Update RULES.js 2021-07-23 12:00:57 +08:00
liufeng
84e0699fa5 feat(components): 增加可以被moment转化成功的时间正则 2021-06-04 18:26:53 +08:00
Russell
8f3b1bd731 chore: yarn.lock 2021-05-28 09:23:51 +08:00
Russell
045d547044 0.3.10 2021-05-28 09:07:47 +08:00
Russell
c1da95fb10 chore: 更新日志 2021-05-28 09:07:02 +08:00
Russell
b9a81ed54f fix: 禁止日期可以通过00月00日(#173) 2021-05-28 09:02:34 +08:00
any86
1d4d366edc chore: v0.3.9 2021-04-20 14:09:32 +08:00
any86
d1669d1202 0.3.9 2021-04-20 14:08:13 +08:00
any86
aeda23e525 chore: 删除主要开发者列 2021-04-20 13:59:57 +08:00
any86
e11719698d chore: 更新日志 2021-04-20 13:58:34 +08:00
any86
e801a13e8c Merge branch 'develop' of https://github.com/any86/any-rule into develop 2021-04-20 13:51:01 +08:00
any86
aecee22e0d chore: linguist-vendored 2021-04-20 13:50:56 +08:00
383514580
38d9379311 Merge branch 'develop' 2021-03-09 22:42:58 +08:00
any86
e3e204bb26
Merge pull request #156 from richex-cn/new-rule-uuid
add rule for UUID/GUID
2021-03-09 22:22:37 +08:00
Richex
0016aad978 add rule for UUID/GUID 2021-03-08 14:30:12 +08:00
any86
479f5d3f6e
Merge pull request #154 from richex-cn/fix-web-case-sensitive
fix: 修复无法搜索大写字母的问题
2021-03-08 09:13:54 +08:00
Richex
08e2ab4125 fix: 修复无法搜索大写字母的问题 2021-03-07 15:37:09 +08:00
any86
bc421d25d2 chore: 优化web版本样式 2021-02-03 13:42:45 +08:00
any86
b8ddf5a515 chore(demo): 增加阴影 2021-02-03 13:16:35 +08:00
any86
7144a6744e [ci-skip]: 让ci忽略gh-page分支 2021-01-29 08:30:55 +08:00
any86
8e32df889e fix: 修复ip中的"."没有被转义 2021-01-29 08:23:33 +08:00
any86
e4f8f56da5 v0.3.8 2021-01-17 16:50:53 +08:00
any86
b6ba32e698 0.3.8 2021-01-17 16:50:21 +08:00
any86
e438e8ed5a chore: 更新日志 2021-01-17 16:50:14 +08:00
any86
d13ce0827b perf: 座机号支持分机号(#144) 2021-01-17 16:43:34 +08:00
any86
d06315c9ae perf: 精简一些冗余的写法(#150) 2021-01-17 16:42:57 +08:00
any86
3e72111e87 fix: 修复新能源汽车不匹配车牌第三位为字母的情况(#148) 2021-01-17 16:22:52 +08:00
any86
34fe7e7121 fix: 修正"."前面没有加转移符号(#141) 2020-12-21 09:54:01 +08:00
any86
c1a1552bf2 Merge branch 'develop' 2020-11-27 13:42:40 +08:00
any86
f58e16ab7e docs: 更新文档 2020-11-25 09:35:52 +08:00
any86
b7c3545c41 0.3.7 2020-11-25 09:33:18 +08:00
any86
640e7e7c91 0.3.7 更新日志 2020-11-25 09:32:32 +08:00
any86
3a592c90f8
Merge pull request #138 from any86/dependabot/npm_and_yarn/packages/www/highlight.js-9.18.5
chore(deps): bump highlight.js from 9.15.8 to 9.18.5 in /packages/www
2020-11-25 09:23:51 +08:00
any86
178b98a453 fix: 精准IP v4正则(#135) 2020-11-25 09:23:23 +08:00
dependabot[bot]
22a89d8ec2
chore(deps): bump highlight.js from 9.15.8 to 9.18.5 in /packages/www
Bumps [highlight.js](https://github.com/highlightjs/highlight.js) from 9.15.8 to 9.18.5.
- [Release notes](https://github.com/highlightjs/highlight.js/releases)
- [Changelog](https://github.com/highlightjs/highlight.js/blob/9.18.5/CHANGES.md)
- [Commits](https://github.com/highlightjs/highlight.js/compare/9.15.8...9.18.5)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-25 00:53:57 +00:00
any86
dd1f24f3cd
Merge pull request #131 from liuyib/patch-1
chore: fix word spelling error
2020-10-20 16:45:51 +08:00
EvanOne(文一)
eb014b12a0
chore: fix word spelling error 2020-10-18 15:49:40 +08:00
any86
c2d3194a44
Merge pull request #125 from any86/dependabot/npm_and_yarn/packages/www/node-sass-4.13.1
chore(deps): bump node-sass from 4.12.0 to 4.13.1 in /packages/www
2020-10-09 21:43:28 +08:00
any86
c2bb7947b4
Merge pull request #126 from any86/dependabot/npm_and_yarn/packages/www/http-proxy-1.18.1
chore(deps): bump http-proxy from 1.17.0 to 1.18.1 in /packages/www
2020-10-09 21:43:13 +08:00
any86
a5fb512112
Merge pull request #129 from liuyib/patch-1
chore: In VS Code, the repository cannot be opened
2020-10-09 21:41:57 +08:00
any86
f306d5fb9c feat: 新增"座机(tel phone)电话(国内), 区号可选" 2020-10-09 17:22:29 +08:00
liuyib
9f9d2f0c86
chore: Unable to resolve resource
git+https://github.com/any86/any-rule.git
2020-09-25 19:44:42 +08:00
dependabot[bot]
9395ca5bb1
chore(deps): bump http-proxy from 1.17.0 to 1.18.1 in /packages/www
Bumps [http-proxy](https://github.com/http-party/node-http-proxy) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/http-party/node-http-proxy/releases)
- [Changelog](https://github.com/http-party/node-http-proxy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/http-party/node-http-proxy/compare/1.17.0...1.18.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-10 08:45:40 +00:00
dependabot[bot]
e447fd435b
chore(deps): bump node-sass from 4.12.0 to 4.13.1 in /packages/www
Bumps [node-sass](https://github.com/sass/node-sass) from 4.12.0 to 4.13.1.
- [Release notes](https://github.com/sass/node-sass/releases)
- [Changelog](https://github.com/sass/node-sass/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sass/node-sass/compare/v4.12.0...v4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-04 20:36:42 +00:00
any86
7ef6a8eadf perf: ip地址增加端口支持(#122) 2020-08-11 11:25:14 +08:00
any86
78f7a36cd1 chore: 发布0.3.6 2020-08-03 10:36:50 +08:00
any86
ed96040529 0.3.6 2020-08-03 10:35:13 +08:00
any86
9a4854c678 chore: 更新日志 2020-08-03 10:34:44 +08:00
any86
a526ed2db9 chore: 简化pre-push钩子的动作 2020-08-03 10:19:10 +08:00
any86
a3d67504ec refactor:增加"港澳台"身份证(#116) 2020-08-03 10:18:51 +08:00
any86
d568c54652 chore: add yarn.lock 2020-08-03 10:17:53 +08:00
any86
185d3d4802 Merge branch 'master' into develop 2020-08-03 09:43:08 +08:00
any86
89235cd9fc
Merge pull request #117 from ilxiaoli/master
feat: 增加"添加港澳台证件号"
2020-08-03 09:33:22 +08:00
Bin
c4067ddfc2
Update RULES.js
添加港澳台证件号正则
2020-07-30 17:02:15 +08:00
any86
a66c7b636b
Merge pull request #113 from any86/dependabot/npm_and_yarn/lodash-4.17.19
chore(deps): bump lodash from 4.17.15 to 4.17.19
2020-07-21 10:45:22 +08:00
any86
43f838952e
Merge pull request #110 from xiaoyierle/develop
fix: 添加统一社会信用代码15、18、20位长度匹配
2020-07-21 10:44:47 +08:00
any86
d9c9b89bcb Merge branch 'develop' 2020-07-18 23:54:07 +08:00
any86
4077842ef2 0.3.5 2020-07-18 23:51:05 +08:00
any86
d1676e3ef0 chore: 更新文档 2020-07-18 23:48:06 +08:00
any86
1d010da622 chore: 更新日志 2020-07-18 23:47:38 +08:00
any86
70a77a0d4b feat: 新增"数字和英文字母组成,并且同时含有数字和英文字母"(#108) 2020-07-18 23:45:06 +08:00
any86
58d9ac29b5 fix: 修复"车牌号"可以通过"浙苏H6F681"的问题(#111) 2020-07-18 23:41:09 +08:00
dependabot[bot]
0197ab0eb8
chore(deps): bump lodash from 4.17.15 to 4.17.19
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-17 22:00:18 +00:00
wangzhy
0adf663dfb fix 添加统一社会信用代码15、18、20位长度匹配 2020-07-16 11:35:33 +08:00
any86
8e3df6b324 Merge remote-tracking branch 'origin/develop'
* origin/develop:
  chore: 发布0.3.4
  0.3.4
  chore: 更新日志
  docs: 更新文档
  chore: 修改钩子, 提交内容的同时提交文档
  fix: 修正'车牌号(新能源+非新能源)'未对长度进行限制(#107)
  chore: 更新主页
2020-06-14 10:29:30 +08:00
any86
b313517b61 chore: 发布0.3.4 2020-06-14 09:47:30 +08:00
any86
d080694aa4 Merge remote-tracking branch 'origin/develop'
* origin/develop:
  chore: 更新主页
2020-06-10 10:47:46 +08:00
any86
9b1cf30a88 Merge remote-tracking branch 'origin/develop'
* origin/develop:
  chore: 更新文档
  fix: 修正"身份证"中月份可以匹配00月的bug(#106)
  匹配连续重复的字符
  fix: 座机支持4位区号,8位电话号
  fix: 根据用户需求, "qq@qq"样式的email邮箱地址不再通过验证(#92)
  0.3.3
  chore: vsce package  --yarn
  chore: 更新包
  chore: 更新日志
  chore(ci): 更新action的version字段为node-version
  chore(ci): gh-pages分支不再进行ci
  docs: 更新主页
2020-06-10 09:32:10 +08:00
any86
ac9456112d
Update README.md 2020-05-26 22:29:16 +08:00
16 changed files with 1229 additions and 19124 deletions

View File

@ -5,9 +5,10 @@
version: 2 version: 2
jobs: jobs:
build: build:
branches: filters:
ignore: branches:
- gh-pages ignore:
- gh-pages
docker: docker:
# specify the version you desire here # specify the version you desire here
- image: circleci/node:12.14.1 - image: circleci/node:12.14.1
@ -29,7 +30,7 @@ jobs:
# - run: yarn install # - run: yarn install
# - run: yarn add codecov # - run: yarn add codecov
- run: yarn add chalk - run: yarn add chalk@2.4.2

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
packages/*/** linguist-vendored

9
.gitignore vendored
View File

@ -1,5 +1,12 @@
out out
node_modules node_modules
coverage
.nyc_output
.vscode-test/ .vscode-test/
.idea
.vscode
.DS_Store
*.vsix *.vsix
yarn-error.log yarn-error.log
.rpt2_cache
dist

View File

@ -1,6 +1,50 @@
# 更新日志 # 更新日志
🚀 [提交问题](https://github.com/any86/any-rule/issues/new) 🚀 [提交问题](https://github.com/any86/any-rule/issues/new)
### 0.3.18(2022-11-07)
- 优化数字/货币金额(支持负数、千分位分隔符)
- 优化小数(支持科学计数)
- 优化缩短"用户名校验"正则长度
- 增加户口薄正则
- 增加军官证正则
- 修复MAC地址的第二位一定是偶数(#264)
### 0.3.13(2022-01-10)
- 修正"网址"正则, 兼容更多符合的网址.
- 修正澳门身份证错误.
### 0.3.12(2021-10-20)
- 修复网址中带有"()"不能通过.
- 新增"整数"/"浮点数"等正则.
### 0.3.11(2021-09-26)
- 修复新版vscode中"@zz"字符失效.
- 优化"身份证15/18"正则.
### 0.3.10(2021-05-28)
- 禁止"日期"可以通过"00"月和"00"日
### 0.3.9(2021-04-20)
- 新增"GUID/UUID"正则.
- 修复ip中的"."没有被转义.
### 0.3.8(2021-01-17)
- 优化一些冗余的正则拼写
- 修复新能源汽车不匹配第三位为字母的情况.
- 座机电话兼容带分机号的情况.
### 0.3.7(2020-11-25)
- 修复"IPv4"不严格, 且增加端口校验.
- 新增"座机电话(区号可选)"
### 0.3.6(2020-08-03)
- 新增"港澳台身份证"
### 0.3.5(2020-07-18)
- 修复"车牌号"可以通过"浙苏H6F681"的问题
- 新增"数字和英文字母组成,并且同时含有数字和英文字母"
### 0.3.4(2020-06-14) ### 0.3.4(2020-06-14)
- 修正"车牌号(新能源+非新能源)"未对长度进行限制. - 修正"车牌号(新能源+非新能源)"未对长度进行限制.
- 修正"身份证"中月份可以匹配00月的bug. - 修正"身份证"中月份可以匹配00月的bug.

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Russell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

783
README.md
View File

@ -1,9 +1,9 @@
# 正则大全 ![已收录64条](https://img.shields.io/badge/已收录-64条-673ab7.svg) [![版本](https://badgen.net/vs-marketplace/v/russell.any-rule)](https://marketplace.visualstudio.com/items?itemName=russell.any-rule) [![安装量](https://badgen.net/vs-marketplace/i/russell.any-rule)](https://marketplace.visualstudio.com/items?itemName=russell.any-rule) [![下载量](https://badgen.net/vs-marketplace/d/russell.any-rule)](https://marketplace.visualstudio.com/items?itemName=russell.any-rule) ![MIT](https://img.shields.io/badge/license-MIT-F44336.svg) [![CircleCI](https://badgen.net/github/status/any86/any-rule/master/ci/circleci)](https://circleci.com/gh/any86/any-rule) # 正则大全 ![已收录84条](https://img.shields.io/badge/已收录-84条-673ab7.svg) [![版本](https://badgen.net/vs-marketplace/v/russell.any-rule)](https://marketplace.visualstudio.com/items?itemName=russell.any-rule) [![安装量](https://badgen.net/vs-marketplace/i/russell.any-rule)](https://marketplace.visualstudio.com/items?itemName=russell.any-rule) [![下载量](https://badgen.net/vs-marketplace/d/russell.any-rule)](https://marketplace.visualstudio.com/items?itemName=russell.any-rule) ![MIT](https://img.shields.io/badge/license-MIT-F44336.svg) [![CircleCI](https://badgen.net/github/status/any86/any-rule/master/ci/circleci)](https://circleci.com/gh/any86/any-rule)
🦕支持**web** / **vscode** / **idea** / **Alfred Workflow**多平台 🦕支持**web** / **vscode** / **idea** / **Alfred Workflow**多平台
## :rocket:web版本 ## :rocket:web版本
https://any86.github.io/any-rule/ https://any-rule.vercel.app/
## 🍭vscode插件 ## 🍭vscode插件
@ -16,40 +16,48 @@ vscode应用商店中搜索"**any-rule**".
1. 按**F1**(mac下fn+F1)打开正则列表. 1. 按**F1**(mac下fn+F1)打开正则列表.
2. **输入关键词搜索**, 比如"手机". 2. **输入关键词搜索**, 比如"手机".
![预览图](https://user-gold-cdn.xitu.io/2020/1/10/16f8e01a684a0a18?w=420&h=243&f=gif&s=414162) ![GIF](https://user-images.githubusercontent.com/8264787/146724787-888a8666-5d2a-4e5e-b383-aec7c53bd312.gif)
**方式2:** **方式2:**
右键选择"🦕正则大全". 右键选择"🦕正则大全".
![](https://user-gold-cdn.xitu.io/2020/2/28/17087735718cca3b?w=389&h=400&f=png&s=55934) ![GIF](https://user-images.githubusercontent.com/8264787/146725447-4d92caed-2dd0-4f11-91d1-8da9cd8ff08b.gif)
**方式3:** **方式3:**
在代码任意位置输入"**@zz**". 在代码任意位置输入"**@zz**".
![GIF](https://user-images.githubusercontent.com/8264787/146725402-30b34119-b709-4d49-adb2-af8dbb786d3b.gif)
![预览图](https://user-gold-cdn.xitu.io/2020/2/28/17089999afc7a21c?w=722&h=408&f=gif&s=299355)
## 👩‍🏫图解正则 ## 👩‍🏫图解正则
<details> <details>
<summary>查看详情</summary> <summary>查看详情</summary>
每次在any-rule中选择正则后会弹出提示, 可点击"🤖图解正则". 每次在any-rule中选择正则后会弹出提示, 可点击"🤖图解正则".
![预览图](https://user-gold-cdn.xitu.io/2020/2/23/1706e32c3a6fb116?w=533&h=95&f=png&s=21563) ![image](https://user-images.githubusercontent.com/8264787/146726200-d97e48c3-df76-4531-8210-b6935fffb997.png)
点击后可以看到正则解析, 方便大家学习. 点击后可以看到正则解析, 方便大家学习.
![预览图](https://user-gold-cdn.xitu.io/2020/2/23/1706e349b600c28b?w=1151&h=500&f=png&s=45210) ![image](https://user-images.githubusercontent.com/8264787/146726350-58166bf9-7f7f-4685-86aa-f055d0c0b914.png)
**注意**: 图解直接使用了https://regexper.com, 在此对作者表示敬意和感谢. **注意**: 图解直接使用了https://regexper.com, 在此对作者表示敬意和感谢.
</details> </details>
## 社区版本 ## 社区版本
社区版本非本人维护, 只是其他开发者使用了any-rule整理的正则内容, 如使用出现问题可直接与其开发者联系.
[idea版](https://github.com/zhoriya/idea-rule) [idea版](https://github.com/zhoriya/idea-rule)
[Alfred Workflow版](https://github.com/cccyb/workflows) [Alfred Workflow版](https://github.com/cccyb/workflows)
[hyjs: 函数封装版](https://github.com/heiyehk/hyjs/tree/main/packages/utils)
[命令行版本](https://github.com/shenguanjiejie/workwork)
[uTools版本](https://github.com/trentlee0/utools-any-rule)
## :fire:关于PR ## :fire:关于PR
欢迎大家PR, 步骤如下: 欢迎大家PR, 步骤如下:
1. **正则**请在**packages/www/src/RULES.js**中添加. 1. **正则**请在**packages/www/src/RULES.js**中添加.
@ -59,343 +67,424 @@ vscode应用商店中搜索"**any-rule**".
在此感谢大家对**any-rule**做出的贡献! 在此感谢大家对**any-rule**做出的贡献!
## 👽主要开发者
按照加入时间排序
<table>
<tr>
<td>
<a href="https://github.com/MrTenger"><img width="60" src="https://avatars3.githubusercontent.com/u/10781715?s=60&v=4"></a>
</td>
<td>
<a href="https://github.com/giraffeComing"><img width="60" src="https://avatars2.githubusercontent.com/u/14800669?s=460&v=4"></a>
</td>
<td>
<a href="https://github.com/microud"><img width="60" src="https://avatars1.githubusercontent.com/u/10163257?s=60&v=4"></a>
</td>
<td>
<a href="https://github.com/52cik"><img width="60" src="https://avatars0.githubusercontent.com/u/5033310?s=60&v=4"></a>
</td>
</tr>
</table>
## 🍔正则 ## 🍔正则
### 火车车次 ### 火车车次
```javascript ```javascript
/^[GCDZTSPKXLY1-9]\d{1,4}$/ /^[GCDZTSPKXLY1-9]\d{1,4}$/
``` ```
### 手机机身码(IMEI) ### 手机机身码(IMEI)
```javascript ```javascript
/^\d{15,17}$/ /^\d{15,17}$/
``` ```
### 必须带端口号的网址(或ip) ### 必须带端口号的网址(或ip)
```javascript ```javascript
/^((ht|f)tps?:\/\/)?[\w-]+(\.[\w-]+)+:\d{1,5}\/?$/ /^((ht|f)tps?:\/\/)?[\w-]+(\.[\w-]+)+:\d{1,5}\/?$/
``` ```
### 网址(url,支持端口和"?+参数"和"#+参数) ### 网址(URL)
```javascript ```javascript
/^(((ht|f)tps?):\/\/)?[\w-]+(\.[\w-]+)+([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?$/ /^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/
``` ```
### 统一社会信用代码 ### 统一社会信用代码
```javascript ```javascript
/^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/ /^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/
``` ```
### 迅雷链接 ### 统一社会信用代码(宽松匹配)(15位/18位/20位数字/字母)
```javascript ```javascript
/^thunderx?:\/\/[a-zA-Z\d]+=$/ /^(([0-9A-Za-z]{15})|([0-9A-Za-z]{18})|([0-9A-Za-z]{20}))$/
``` ```
### ed2k链接(宽松匹配) ### 迅雷链接
```javascript ```javascript
/^ed2k:\/\/\|file\|.+\|\/$/ /^thunderx?:\/\/[a-zA-Z\d]+=$/
``` ```
### 磁力链接(宽松匹配) ### ed2k链接(宽松匹配)
```javascript ```javascript
/^magnet:\?xt=urn:btih:[0-9a-fA-F]{40,}.*$/ /^ed2k:\/\/\|file\|.+\|\/$/
``` ```
### 子网掩码 ### 磁力链接(宽松匹配)
```javascript ```javascript
/^(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])(?:\.(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])){3}$/ /^magnet:\?xt=urn:btih:[0-9a-fA-F]{40,}.*$/
``` ```
### linux"隐藏文件"路径 ### 子网掩码(不包含 0.0.0.0)
```javascript ```javascript
/^\/(?:[^/]+\/)*\.[^/]*/ /^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(255|254|252|248|240|224|192|128|0)$/
``` ```
### linux文件夹路径 ### linux"隐藏文件"路径
```javascript ```javascript
/^\/(?:[^/]+\/)*$/ /^\/(?:[^/]+\/)*\.[^/]*/
``` ```
### linux文件路径 ### linux文件夹路径
```javascript ```javascript
/^\/(?:[^/]+\/)*[^/]+$/ /^\/(?:[^/]+\/)*$/
``` ```
### window"文件夹"路径 ### linux文件路径
```javascript ```javascript
/^[a-zA-Z]:\\(?:\w+\\?)*$/ /^\/(?:[^/]+\/)*[^/]+$/
``` ```
### window下"文件"路径 ### window"文件夹"路径
```javascript ```javascript
/^[a-zA-Z]:\\(?:\w+\\)*\w+\.\w+$/ /^[a-zA-Z]:\\(?:\w+\\?)*$/
``` ```
### 股票代码(A股) ### window下"文件"路径
```javascript ```javascript
/^(s[hz]|S[HZ])(000[\d]{3}|002[\d]{3}|300[\d]{3}|600[\d]{3}|60[\d]{4})$/ /^[a-zA-Z]:\\(?:\w+\\)*\w+\.\w+$/
``` ```
### 大于等于0, 小于等于150, 支持小数位出现5, 如145.5, 用于判断考卷分数 ### 股票代码(A股)
```javascript ```javascript
/^150$|^(?:\d|[1-9]\d|1[0-4]\d)(?:.5)?$/ /^(s[hz]|S[HZ])(000[\d]{3}|002[\d]{3}|300[\d]{3}|600[\d]{3}|60[\d]{4})$/
``` ```
### html注释 ### 大于等于0, 小于等于150, 支持小数位出现5, 如145.5, 用于判断考卷分数
```javascript ```javascript
/^<!--[\s\S]*?-->$/ /^150$|^(?:\d|[1-9]\d|1[0-4]\d)(?:\.5)?$/
``` ```
### md5格式(32位) ### html注释
```javascript ```javascript
/^([a-f\d]{32}|[A-F\d]{32})$/ /<!--[\s\S]*?-->/g
``` ```
### 版本号(version)格式必须为X.Y.Z ### md5格式(32位)
```javascript ```javascript
/^\d+(?:\.\d+){2}$/ /^[a-fA-F0-9]{32}$/
``` ```
### 视频(video)链接地址(视频格式可按需增删) ### GUID/UUID
```javascript ```javascript
/^https?:\/\/(.+\/)+.+(\.(swf|avi|flv|mpg|rm|mov|wav|asf|3gp|mkv|rmvb|mp4))$/i /^[a-f\d]{4}(?:[a-f\d]{4}-){4}[a-f\d]{12}$/i
``` ```
### 图片(image)链接地址(图片格式可按需增删) ### 版本号(version)格式必须为X.Y.Z
```javascript ```javascript
/^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i /^\d+(?:\.\d+){2}$/
``` ```
### 24小时制时间HH:mm:ss ### 视频(video)链接地址(视频格式可按需增删)
```javascript ```javascript
/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/ /^https?:\/\/(.+\/)+.+(\.(swf|avi|flv|mpg|rm|mov|wav|asf|3gp|mkv|rmvb|mp4))$/i
``` ```
### 12小时制时间hh:mm:ss ### 图片(image)链接地址(图片格式可按需增删)
```javascript ```javascript
/^(?:1[0-2]|0?[1-9]):[0-5]\d:[0-5]\d$/ /^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i
``` ```
### base64格式 ### 24小时制时间HH:mm:ss
```javascript ```javascript
/^\s*data:(?:[a-z]+\/[a-z0-9-+.]+(?:;[a-z-]+=[a-z0-9-]+)?)?(?:;base64)?,([a-z0-9!$&',()*+;=\-._~:@/?%\s]*?)\s*$/i /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/
``` ```
### 数字/货币金额(支持负数、千分位分隔符) ### 12小时制时间hh:mm:ss
```javascript ```javascript
/^-?\d+(,\d{3})*(\.\d{1,2})?$/ /^(?:1[0-2]|0?[1-9]):[0-5]\d:[0-5]\d$/
``` ```
### 数字/货币金额 (只支持正数、不支持校验千分位分隔符) ### base64格式
```javascript ```javascript
/(?:^[1-9]([0-9]+)?(?:\.[0-9]{1,2})?$)|(?:^(?:0){1}$)|(?:^[0-9]\.[0-9](?:[0-9])?$)/ /^\s*data:(?:[a-z]+\/[a-z0-9-+.]+(?:;[a-z-]+=[a-z0-9-]+)?)?(?:;base64)?,([a-z0-9!$&',()*+;=\-._~:@/?%\s]*?)\s*$/i
``` ```
### 银行卡号10到30位, 覆盖对公/私账户, 参考[微信支付](https://pay.weixin.qq.com/wiki/doc/api/xiaowei.php?chapter=22_1) ### 数字/货币金额(支持负数、千分位分隔符)
```javascript ```javascript
/^[1-9]\d{9,29}$/ /^-?\d{1,3}(,\d{3})*(\.\d{1,2})?$/
``` ```
### 中文姓名 ### 银行卡号10到30位, 覆盖对公/私账户, 参考[微信支付](https://pay.weixin.qq.com/wiki/doc/api/xiaowei.php?chapter=22_1)
```javascript ```javascript
/^(?:[\u4e00-\u9fa5·]{2,16})$/ /^[1-9]\d{9,29}$/
``` ```
### 英文姓名 ### 中文姓名
```javascript ```javascript
/(^[a-zA-Z]{1}[a-zA-Z\s]{0,20}[a-zA-Z]{1}$)/ /^(?:[\u4e00-\u9fa5·]{2,16})$/
``` ```
### 车牌号(新能源) ### 英文姓名
```javascript ```javascript
/[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-HJ-NP-Z]{1}(([0-9]{5}[DF])|([DF][A-HJ-NP-Z0-9][0-9]{4}))$/ /(^[a-zA-Z][a-zA-Z\s]{0,20}[a-zA-Z]$)/
``` ```
### 车牌号(非新能源) ### 车牌号(新能源)
```javascript ```javascript
/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-HJ-NP-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/ /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z](([DF]((?![IO])[a-zA-Z0-9](?![IO]))[0-9]{4})|([0-9]{5}[DF]))$/
``` ```
### 车牌号(新能源+非新能源) ### 车牌号(非新能源)
```javascript ```javascript
/^(?:[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-HJ-NP-Z]{1}(?:(?:[0-9]{5}[DF])|(?:[DF](?:[A-HJ-NP-Z0-9])[0-9]{4})))$|(?:[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9 挂学警港澳]{1})$/ /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]$/
``` ```
### 手机号(mobile phone)中国(严谨), 根据工信部2019年最新公布的手机号段 ### 车牌号(新能源+非新能源)
```javascript ```javascript
/^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-7|9])|(?:5[0-3|5-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[1|8|9]))\d{8}$/ /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]$/
``` ```
### 手机号(mobile phone)中国(宽松), 只要是13,14,15,16,17,18,19开头即可 ### 手机号(mobile phone)中国(严谨), 根据工信部2019年最新公布的手机号段
```javascript ```javascript
/^(?:(?:\+|00)86)?1[3-9]\d{9}$/ /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[01256789]))\d{8}$/
``` ```
### 手机号(mobile phone)中国(最宽松), 只要是1开头即可, 如果你的手机号是用来接收短信, 优先建议选择这一条 ### 手机号(mobile phone)中国(宽松), 只要是13,14,15,16,17,18,19开头即可
```javascript ```javascript
/^(?:(?:\+|00)86)?1\d{10}$/ /^(?:(?:\+|00)86)?1[3-9]\d{9}$/
``` ```
### date(日期) ### 手机号(mobile phone)中国(最宽松), 只要是1开头即可, 如果你的手机号是用来接收短信, 优先建议选择这一条
```javascript ```javascript
/^\d{4}(-)(1[0-2]|0?\d)\1([0-2]\d|\d|30|31)$/ /^(?:(?:\+|00)86)?1\d{10}$/
``` ```
### email(邮箱) ### 日期(宽松)
```javascript ```javascript
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ /^\d{1,4}(-)(1[0-2]|0?[1-9])\1(0?[1-9]|[1-2]\d|30|31)$/
``` ```
### 座机(tel phone)电话(国内),如: 0341-86091234 ### 日期(严谨, 支持闰年判断)
```javascript ```javascript
/^\d{3}-\d{8}$|^\d{4}-\d{7,8}$/ /^(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)$/
``` ```
### 身份证号(1代,15位数字) ### 中国省
```javascript ```javascript
/^[1-9]\d{7}(?:0\d|10|11|12)(?:0[1-9]|[1-2][\d]|30|31)\d{3}$/ /^浙江|上海|北京|天津|重庆|黑龙江|吉林|辽宁|内蒙古|河北|新疆|甘肃|青海|陕西|宁夏|河南|山东|山西|安徽|湖北|湖南|江苏|四川|贵州|云南|广西|西藏|江西|广东|福建|台湾|海南|香港|澳门$/
``` ```
### 身份证号(2代,18位数字),最后一位是校验位,可能为数字或字符X ### 可以被moment转化成功的时间 YYYYMMDD HH:mm:ss
```javascript ```javascript
/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/ /^\d{4}([/:-\S])(1[0-2]|0?[1-9])\1(0?[1-9]|[1-2]\d|30|31) (?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/
``` ```
### 身份证号, 支持1/2代(15位/18位数字) ### email(邮箱)
```javascript ```javascript
/(^\d{8}(0\d|10|11|12)([0-2]\d|30|31)\d{3}$)|(^\d{6}(18|19|20)\d{2}(0[1-9]|10|11|12)([0-2]\d|30|31)\d{3}(\d|X|x)$)/ /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
``` ```
### 护照(包含香港、澳门) ### 座机(tel phone)电话(国内),如: 0341-86091234
```javascript ```javascript
/(^[EeKkGgDdSsPpHh]\d{8}$)|(^(([Ee][a-fA-F])|([DdSsPp][Ee])|([Kk][Jj])|([Mm][Aa])|(1[45]))\d{7}$)/ /^(?:(?:\d{3}-)?\d{8}|^(?:\d{4}-)?\d{7,8})(?:-\d+)?$/
``` ```
### 帐号是否合法(字母开头允许5-16字节允许字母数字下划线组合 ### 身份证号(1代,15位数字)
```javascript ```javascript
/^[a-zA-Z]\w{4,15}$/ /^[1-9]\d{7}(?:0\d|10|11|12)(?:0[1-9]|[1-2][\d]|30|31)\d{3}$/
``` ```
### 中文/汉字 ### 身份证号(2代,18位数字),最后一位是校验位,可能为数字或字符X
```javascript ```javascript
/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/ /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/
``` ```
### 小数 ### 身份证号, 支持1/2代(15位/18位数字)
```javascript ```javascript
/^\d+\.\d+$/ /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/
``` ```
### 数字 ### 护照(包含香港、澳门)
```javascript ```javascript
/^\d{1,}$/ /(^[EeKkGgDdSsPpHh]\d{8}$)|(^(([Ee][a-fA-F])|([DdSsPp][Ee])|([Kk][Jj])|([Mm][Aa])|(1[45]))\d{7}$)/
``` ```
### html标签(宽松匹配) ### 帐号是否合法(字母开头允许5-16字节允许字母数字下划线组合
```javascript ```javascript
/<(\w+)[^>]*>(.*?<\/\1>)?/ /^[a-zA-Z]\w{4,15}$/
``` ```
### qq号格式正确 ### 中文/汉字
```javascript ```javascript
/^[1-9][0-9]{4,10}$/ /^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/
``` ```
### 数字和字母组成 ### 小数(支持科学计数)
```javascript ```javascript
/^[A-Za-z0-9]+$/ /^[+-]?(\d+([.]\d*)?([eE][+-]?\d+)?|[.]\d+([eE][+-]?\d+)?)$/
``` ```
### 英文字母 ### 只包含数字
```javascript ```javascript
/^[a-zA-Z]+$/ /^\d+$/
``` ```
### 小写英文字母组成 ### html标签(宽松匹配)
```javascript ```javascript
/^[a-z]+$/ /<(\w+)[^>]*>(.*?<\/\1>)?/
``` ```
### 大写英文字母 ### 匹配中文汉字和中文标点
```javascript ```javascript
/^[A-Z]+$/ /[\u4e00-\u9fa5|\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]/
``` ```
### 密码强度校验最少6位包括至少1个大写字母1个小写字母1个数字1个特殊字符 ### qq号格式正确
```javascript ```javascript
/^\S*(?=\S{6,})(?=\S*\d)(?=\S*[A-Z])(?=\S*[a-z])(?=\S*[!@#$%^&*? ])\S*$/ /^[1-9][0-9]{4,10}$/
``` ```
### 用户名校验4到16位字母数字下划线减号 ### 数字和字母组成
```javascript ```javascript
/^[a-zA-Z0-9_-]{4,16}$/ /^[A-Za-z0-9]+$/
``` ```
### ip-v4 ### 英文字母
```javascript ```javascript
/^(?:(?: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]?)$/ /^[a-zA-Z]+$/
``` ```
### ip-v6 ### 小写英文字母组成
```javascript ```javascript
/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i /^[a-z]+$/
``` ```
### 16进制颜色 ### 大写英文字母
```javascript ```javascript
/^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/ /^[A-Z]+$/
``` ```
### 微信号(wx)6至20位以字母开头字母数字减号下划线 ### 密码强度校验最少6位包括至少1个大写字母1个小写字母1个数字1个特殊字符
```javascript ```javascript
/^[a-zA-Z][-_a-zA-Z0-9]{5,19}$/ /^\S*(?=\S{6,})(?=\S*\d)(?=\S*[A-Z])(?=\S*[a-z])(?=\S*[!@#$%^&*? ])\S*$/
``` ```
### 邮政编码(中国) ### 用户名校验4到16位字母数字下划线减号
```javascript ```javascript
/^(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}$/ /^[\w-]{4,16}$/
``` ```
### 中文和数字 ### ip-v4[:端口]
```javascript ```javascript
/^((?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])|(\d))+$/ /^((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$/
``` ```
### 不能包含字母 ### ip-v6[:端口]
```javascript ```javascript
/^[^A-Za-z]*$/ /(^(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$)|(^\[(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))\](?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$)/i
``` ```
### java包名 ### 16进制颜色
```javascript ```javascript
/^([a-zA-Z_][a-zA-Z0-9_]*)+([.][a-zA-Z_][a-zA-Z0-9_]*)+$/ /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3}|[a-fA-F0-9]{8}|[a-fA-F0-9]{4})$/
``` ```
### mac地址 ### 微信号(wx)6至20位以字母开头字母数字减号下划线
```javascript ```javascript
/^((([a-f0-9]{2}:){5})|(([a-f0-9]{2}-){5}))[a-f0-9]{2}$/i /^[a-zA-Z][-_a-zA-Z0-9]{5,19}$/
``` ```
### 匹配连续重复的字符 ### 邮政编码(中国)
```javascript ```javascript
/(.)\1+/ /^(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}$/
``` ```
### 中文和数字
```javascript
/^((?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])|(\d))+$/
```
### 不能包含字母
```javascript
/^[^A-Za-z]*$/
```
### java包名
```javascript
/^([a-zA-Z_]\w*)+([.][a-zA-Z_]\w*)+$/
```
### mac地址
```javascript
/^(([a-f0-9][0,2,4,6,8,a,c,e]:([a-f0-9]{2}:){4})|([a-f0-9][0,2,4,6,8,a,c,e]-([a-f0-9]{2}-){4}))[a-f0-9]{2}$/i
```
### 匹配连续重复的字符
```javascript
/(.)\1+/
```
### 数字和英文字母组成,并且同时含有数字和英文字母
```javascript
/^(?=.*[a-zA-Z])(?=.*\d).+$/
```
### 香港身份证
```javascript
/^[a-zA-Z]\d{6}\([\dA]\)$/
```
### 澳门身份证
```javascript
/^[1|5|7]\d{6}\(\d\)$/
```
### 台湾身份证
```javascript
/^[a-zA-Z][0-9]{9}$/
```
### 大写字母,小写字母,数字,特殊符号 `@#$%^&*`~()-+=` 中任意3项密码
```javascript
/^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]/
```
### ASCII码表中的全部的特殊字符
```javascript
/[\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]+/
```
### 正整数不包含0
```javascript
/^\+?[1-9]\d*$/
```
### 负整数不包含0
```javascript
/^-[1-9]\d*$/
```
### 整数
```javascript
/^(?:0|(?:-?[1-9]\d*))$/
```
### 浮点数
```javascript
/^(-?[1-9]\d*\.\d+|-?0\.\d*[1-9]\d*|0\.0+)$/
```
### 浮点数(严格)
```javascript
/^(-?[1-9]\d*\.\d+|-?0\.\d*[1-9])$/
```
### email(支持中文邮箱)
```javascript
/^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
```
### 域名(非网址, 不包含协议)
```javascript
/^([0-9a-zA-Z-]{1,}\.)+([a-zA-Z]{2,})$/
```
### 军官/士兵证
```javascript
/^[\u4E00-\u9FA5](字第)([0-9a-zA-Z]{4,8})(号?)$/
```
### 户口薄
```javascript
/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
```

6094
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,10 +3,16 @@
"publisher": "russell", "publisher": "russell",
"displayName": "any-rule", "displayName": "any-rule",
"description": "你要的\"正则\"都在这!", "description": "你要的\"正则\"都在这!",
"version": "0.3.4", "version": "0.3.18",
"keywords": [
"vscode",
"typescript",
"regxp",
"正则"
],
"husky": { "husky": {
"hooks": { "hooks": {
"pre-push": "npm run test:rules && npm run build:md && git add README.md && git commit -m 'docs: 更新文档'" "pre-push": "npm run test:rules"
} }
}, },
"scripts": { "scripts": {
@ -25,6 +31,7 @@
"vscode": "^1.12.0" "vscode": "^1.12.0"
}, },
"categories": [ "categories": [
"Snippets",
"Other" "Other"
], ],
"icon": "images/vscode-logo.png", "icon": "images/vscode-logo.png",
@ -33,7 +40,7 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/any86/any-rule.git" "url": "https://github.com/any86/any-rule.git"
}, },
"activationEvents": [ "activationEvents": [
"*" "*"
@ -48,6 +55,11 @@
"type": "string", "type": "string",
"default": "@zz", "default": "@zz",
"description": "触发字符串" "description": "触发字符串"
},
"any-rule.supportedLanguages": {
"type": "string",
"default": "*,javascript,javascriptreact,typescript,typescriptreact,vue,vue-postcss,vue-sugarss,vue-html,json,jsonc,graphql,dart,sql,go,java,php,jade,python,swift,markdown",
"description": "支持的开发语言(用','分割)"
} }
} }
}, },
@ -75,7 +87,7 @@
}, },
{ {
"command": "extension.rule3", "command": "extension.rule3",
"title": "$(rocket) zz: 网址(url,支持端口和\"?+参数\"和\"#+参数)" "title": "$(rocket) zz: 网址(URL)"
}, },
{ {
"command": "extension.rule4", "command": "extension.rule4",
@ -83,239 +95,323 @@
}, },
{ {
"command": "extension.rule5", "command": "extension.rule5",
"title": "$(rocket) zz: 迅雷链接" "title": "$(rocket) zz: 统一社会信用代码(宽松匹配)(15位/18位/20位数字/字母)"
}, },
{ {
"command": "extension.rule6", "command": "extension.rule6",
"title": "$(rocket) zz: ed2k链接(宽松匹配)" "title": "$(rocket) zz: 迅雷链接"
}, },
{ {
"command": "extension.rule7", "command": "extension.rule7",
"title": "$(rocket) zz: 磁力链接(宽松匹配)" "title": "$(rocket) zz: ed2k链接(宽松匹配)"
}, },
{ {
"command": "extension.rule8", "command": "extension.rule8",
"title": "$(rocket) zz: 子网掩码" "title": "$(rocket) zz: 磁力链接(宽松匹配)"
}, },
{ {
"command": "extension.rule9", "command": "extension.rule9",
"title": "$(rocket) zz: linux\"隐藏文件\"路径" "title": "$(rocket) zz: 子网掩码(不包含 0.0.0.0)"
}, },
{ {
"command": "extension.rule10", "command": "extension.rule10",
"title": "$(rocket) zz: linux文件夹路径" "title": "$(rocket) zz: linux\"隐藏文件\"路径"
}, },
{ {
"command": "extension.rule11", "command": "extension.rule11",
"title": "$(rocket) zz: linux文件路径" "title": "$(rocket) zz: linux文件路径"
}, },
{ {
"command": "extension.rule12", "command": "extension.rule12",
"title": "$(rocket) zz: window\"文件夹\"路径" "title": "$(rocket) zz: linux文件路径"
}, },
{ {
"command": "extension.rule13", "command": "extension.rule13",
"title": "$(rocket) zz: window\"文件\"路径" "title": "$(rocket) zz: window\"文件\"路径"
}, },
{ {
"command": "extension.rule14", "command": "extension.rule14",
"title": "$(rocket) zz: 股票代码(A股)" "title": "$(rocket) zz: window下\"文件\"路径"
}, },
{ {
"command": "extension.rule15", "command": "extension.rule15",
"title": "$(rocket) zz: 大于等于0, 小于等于150, 支持小数位出现5, 如145.5, 用于判断考卷分数" "title": "$(rocket) zz: 股票代码(A股)"
}, },
{ {
"command": "extension.rule16", "command": "extension.rule16",
"title": "$(rocket) zz: html注释" "title": "$(rocket) zz: 大于等于0, 小于等于150, 支持小数位出现5, 如145.5, 用于判断考卷分数"
}, },
{ {
"command": "extension.rule17", "command": "extension.rule17",
"title": "$(rocket) zz: md5格式(32位)" "title": "$(rocket) zz: html注释"
}, },
{ {
"command": "extension.rule18", "command": "extension.rule18",
"title": "$(rocket) zz: 版本号(version)格式必须为X.Y.Z" "title": "$(rocket) zz: md5格式(32位)"
}, },
{ {
"command": "extension.rule19", "command": "extension.rule19",
"title": "$(rocket) zz: 视频(video)链接地址(视频格式可按需增删)" "title": "$(rocket) zz: GUID/UUID"
}, },
{ {
"command": "extension.rule20", "command": "extension.rule20",
"title": "$(rocket) zz: 图片(image)链接地址(图片格式可按需增删)" "title": "$(rocket) zz: 版本号(version)格式必须为X.Y.Z"
}, },
{ {
"command": "extension.rule21", "command": "extension.rule21",
"title": "$(rocket) zz: 24小时制时间HH:mm:ss" "title": "$(rocket) zz: 视频(video)链接地址(视频格式可按需增删"
}, },
{ {
"command": "extension.rule22", "command": "extension.rule22",
"title": "$(rocket) zz: 12小时制时间hh:mm:ss" "title": "$(rocket) zz: 图片(image)链接地址(图片格式可按需增删"
}, },
{ {
"command": "extension.rule23", "command": "extension.rule23",
"title": "$(rocket) zz: base64格式" "title": "$(rocket) zz: 24小时制时间HH:mm:ss"
}, },
{ {
"command": "extension.rule24", "command": "extension.rule24",
"title": "$(rocket) zz: 数字/货币金额(支持负数、千分位分隔符" "title": "$(rocket) zz: 12小时制时间hh:mm:ss"
}, },
{ {
"command": "extension.rule25", "command": "extension.rule25",
"title": "$(rocket) zz: 数字/货币金额 (只支持正数、不支持校验千分位分隔符)" "title": "$(rocket) zz: base64格式"
}, },
{ {
"command": "extension.rule26", "command": "extension.rule26",
"title": "$(rocket) zz: 银行卡号10到30位, 覆盖对公/私账户, 参考[微信支付](https://pay.weixin.qq.com/wiki/doc/api/xiaowei.php?chapter=22_1)" "title": "$(rocket) zz: 数字/货币金额(支持负数、千分位分隔符"
}, },
{ {
"command": "extension.rule27", "command": "extension.rule27",
"title": "$(rocket) zz: 中文姓名" "title": "$(rocket) zz: 银行卡号10到30位, 覆盖对公/私账户, 参考[微信支付](https://pay.weixin.qq.com/wiki/doc/api/xiaowei.php?chapter=22_1)"
}, },
{ {
"command": "extension.rule28", "command": "extension.rule28",
"title": "$(rocket) zz: 文姓名" "title": "$(rocket) zz: 文姓名"
}, },
{ {
"command": "extension.rule29", "command": "extension.rule29",
"title": "$(rocket) zz: 车牌号(新能源)" "title": "$(rocket) zz: 英文姓名"
}, },
{ {
"command": "extension.rule30", "command": "extension.rule30",
"title": "$(rocket) zz: 车牌号(新能源)" "title": "$(rocket) zz: 车牌号(新能源)"
}, },
{ {
"command": "extension.rule31", "command": "extension.rule31",
"title": "$(rocket) zz: 车牌号(新能源+非新能源)" "title": "$(rocket) zz: 车牌号(非新能源)"
}, },
{ {
"command": "extension.rule32", "command": "extension.rule32",
"title": "$(rocket) zz: 手机号(mobile phone)中国(严谨), 根据工信部2019年最新公布的手机号段" "title": "$(rocket) zz: 车牌号(新能源+非新能源)"
}, },
{ {
"command": "extension.rule33", "command": "extension.rule33",
"title": "$(rocket) zz: 手机号(mobile phone)中国(宽松), 只要是13,14,15,16,17,18,19开头即可" "title": "$(rocket) zz: 手机号(mobile phone)中国(严谨), 根据工信部2019年最新公布的手机号段"
}, },
{ {
"command": "extension.rule34", "command": "extension.rule34",
"title": "$(rocket) zz: 手机号(mobile phone)中国(宽松), 只要是1开头即可, 如果你的手机号是用来接收短信, 优先建议选择这一条" "title": "$(rocket) zz: 手机号(mobile phone)中国(宽松), 只要是13,14,15,16,17,18,19开头即可"
}, },
{ {
"command": "extension.rule35", "command": "extension.rule35",
"title": "$(rocket) zz: date(日期)" "title": "$(rocket) zz: 手机号(mobile phone)中国(最宽松), 只要是1开头即可, 如果你的手机号是用来接收短信, 优先建议选择这一条"
}, },
{ {
"command": "extension.rule36", "command": "extension.rule36",
"title": "$(rocket) zz: email(邮箱)" "title": "$(rocket) zz: 日期(宽松)"
}, },
{ {
"command": "extension.rule37", "command": "extension.rule37",
"title": "$(rocket) zz: 座机(tel phone)电话(国内),如: 0341-86091234" "title": "$(rocket) zz: 日期(严谨, 支持闰年判断)"
}, },
{ {
"command": "extension.rule38", "command": "extension.rule38",
"title": "$(rocket) zz: 身份证号(1代,15位数字)" "title": "$(rocket) zz: 中国省"
}, },
{ {
"command": "extension.rule39", "command": "extension.rule39",
"title": "$(rocket) zz: 身份证号(2代,18位数字),最后一位是校验位,可能为数字或字符X" "title": "$(rocket) zz: 可以被moment转化成功的时间 YYYYMMDD HH:mm:ss"
}, },
{ {
"command": "extension.rule40", "command": "extension.rule40",
"title": "$(rocket) zz: 身份证号, 支持1/2代(15位/18位数字)" "title": "$(rocket) zz: email(邮箱)"
}, },
{ {
"command": "extension.rule41", "command": "extension.rule41",
"title": "$(rocket) zz: 护照(包含香港、澳门)" "title": "$(rocket) zz: 座机(tel phone)电话(国内),如: 0341-86091234"
}, },
{ {
"command": "extension.rule42", "command": "extension.rule42",
"title": "$(rocket) zz: 帐号是否合法(字母开头允许5-16字节允许字母数字下划线组合" "title": "$(rocket) zz: 身份证号(1代,15位数字)"
}, },
{ {
"command": "extension.rule43", "command": "extension.rule43",
"title": "$(rocket) zz: 中文/汉字" "title": "$(rocket) zz: 身份证号(2代,18位数字),最后一位是校验位,可能为数字或字符X"
}, },
{ {
"command": "extension.rule44", "command": "extension.rule44",
"title": "$(rocket) zz: 小数" "title": "$(rocket) zz: 身份证号, 支持1/2代(15位/18位数字)"
}, },
{ {
"command": "extension.rule45", "command": "extension.rule45",
"title": "$(rocket) zz: 数字" "title": "$(rocket) zz: 护照(包含香港、澳门)"
}, },
{ {
"command": "extension.rule46", "command": "extension.rule46",
"title": "$(rocket) zz: html标签(宽松匹配)" "title": "$(rocket) zz: 帐号是否合法(字母开头允许5-16字节允许字母数字下划线组合"
}, },
{ {
"command": "extension.rule47", "command": "extension.rule47",
"title": "$(rocket) zz: qq号格式正确" "title": "$(rocket) zz: 中文/汉字"
}, },
{ {
"command": "extension.rule48", "command": "extension.rule48",
"title": "$(rocket) zz: 数字和字母组成" "title": "$(rocket) zz: 小数(支持科学计数)"
}, },
{ {
"command": "extension.rule49", "command": "extension.rule49",
"title": "$(rocket) zz: 英文字母" "title": "$(rocket) zz: 只包含数字"
}, },
{ {
"command": "extension.rule50", "command": "extension.rule50",
"title": "$(rocket) zz: 小写英文字母组成" "title": "$(rocket) zz: html标签(宽松匹配)"
}, },
{ {
"command": "extension.rule51", "command": "extension.rule51",
"title": "$(rocket) zz: 大写英文字母" "title": "$(rocket) zz: 匹配中文汉字和中文标点"
}, },
{ {
"command": "extension.rule52", "command": "extension.rule52",
"title": "$(rocket) zz: 密码强度校验最少6位包括至少1个大写字母1个小写字母1个数字1个特殊字符" "title": "$(rocket) zz: qq号格式正确"
}, },
{ {
"command": "extension.rule53", "command": "extension.rule53",
"title": "$(rocket) zz: 用户名校验4到16位字母数字下划线减号" "title": "$(rocket) zz: 数字和字母组成"
}, },
{ {
"command": "extension.rule54", "command": "extension.rule54",
"title": "$(rocket) zz: ip-v4" "title": "$(rocket) zz: 英文字母"
}, },
{ {
"command": "extension.rule55", "command": "extension.rule55",
"title": "$(rocket) zz: ip-v6" "title": "$(rocket) zz: 小写英文字母组成"
}, },
{ {
"command": "extension.rule56", "command": "extension.rule56",
"title": "$(rocket) zz: 16进制颜色" "title": "$(rocket) zz: 大写英文字母"
}, },
{ {
"command": "extension.rule57", "command": "extension.rule57",
"title": "$(rocket) zz: 微信号(wx)6至20位以字母开头字母数字减号下划线" "title": "$(rocket) zz: 密码强度校验最少6位包括至少1个大写字母1个小写字母1个数字1个特殊字符"
}, },
{ {
"command": "extension.rule58", "command": "extension.rule58",
"title": "$(rocket) zz: 邮政编码(中国)" "title": "$(rocket) zz: 用户名校验4到16位字母数字下划线减号"
}, },
{ {
"command": "extension.rule59", "command": "extension.rule59",
"title": "$(rocket) zz: 中文和数字" "title": "$(rocket) zz: ip-v4[:端口]"
}, },
{ {
"command": "extension.rule60", "command": "extension.rule60",
"title": "$(rocket) zz: 不能包含字母" "title": "$(rocket) zz: ip-v6[:端口]"
}, },
{ {
"command": "extension.rule61", "command": "extension.rule61",
"title": "$(rocket) zz: java包名" "title": "$(rocket) zz: 16进制颜色"
}, },
{ {
"command": "extension.rule62", "command": "extension.rule62",
"title": "$(rocket) zz: 微信号(wx)6至20位以字母开头字母数字减号下划线"
},
{
"command": "extension.rule63",
"title": "$(rocket) zz: 邮政编码(中国)"
},
{
"command": "extension.rule64",
"title": "$(rocket) zz: 中文和数字"
},
{
"command": "extension.rule65",
"title": "$(rocket) zz: 不能包含字母"
},
{
"command": "extension.rule66",
"title": "$(rocket) zz: java包名"
},
{
"command": "extension.rule67",
"title": "$(rocket) zz: mac地址" "title": "$(rocket) zz: mac地址"
}, },
{
"command": "extension.rule68",
"title": "$(rocket) zz: 匹配连续重复的字符"
},
{
"command": "extension.rule69",
"title": "$(rocket) zz: 数字和英文字母组成,并且同时含有数字和英文字母"
},
{
"command": "extension.rule70",
"title": "$(rocket) zz: 香港身份证 "
},
{
"command": "extension.rule71",
"title": "$(rocket) zz: 澳门身份证 "
},
{
"command": "extension.rule72",
"title": "$(rocket) zz: 台湾身份证 "
},
{
"command": "extension.rule73",
"title": "$(rocket) zz: 大写字母,小写字母,数字,特殊符号 `@#$%^&*`~()-+=` 中任意3项密码"
},
{
"command": "extension.rule74",
"title": "$(rocket) zz: ASCII码表中的全部的特殊字符"
},
{
"command": "extension.rule75",
"title": "$(rocket) zz: 正整数不包含0"
},
{
"command": "extension.rule76",
"title": "$(rocket) zz: 负整数不包含0"
},
{
"command": "extension.rule77",
"title": "$(rocket) zz: 整数"
},
{
"command": "extension.rule78",
"title": "$(rocket) zz: 浮点数"
},
{
"command": "extension.rule79",
"title": "$(rocket) zz: 浮点数(严格)"
},
{
"command": "extension.rule80",
"title": "$(rocket) zz: email(支持中文邮箱)"
},
{
"command": "extension.rule81",
"title": "$(rocket) zz: 域名(非网址, 不包含协议)"
},
{
"command": "extension.rule82",
"title": "$(rocket) zz: 军官/士兵证"
},
{
"command": "extension.rule83",
"title": "$(rocket) zz: 户口薄"
},
{ {
"command": "extension.rule.callByMenu", "command": "extension.rule.callByMenu",
"title": "🦕正则大全(63条)" "title": "🦕正则大全(84条)"
} }
] ]
}, },
@ -340,4 +436,4 @@
"axios": "^0.19.2", "axios": "^0.19.2",
"transliteration": "^2.1.8" "transliteration": "^2.1.8"
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -6,15 +6,16 @@
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"release": "npm run build && node ./scripts/demo", "release": "npm run build && node ./scripts/demo",
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint",
"rm:nm":"rimraf node_modules"
}, },
"dependencies": { "dependencies": {
"clipboard": "^2.0.4", "clipboard": "^2.0.4",
"core-js": "^2.6.5", "core-js": "^2.6.5",
"crypto-js": "^4.0.0", "crypto-js": "^4.0.0",
"lodash": "^4.17.13", "lodash": "^4.17.13",
"node-sass": "^4.12.0", "node-sass": "^6.0.0",
"sass-loader": "^7.1.0", "sass-loader": "^10.0.0",
"vue": "^2.6.10" "vue": "^2.6.10"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,47 +1,52 @@
<template> <template>
<main> <main>
<article class="fixed"> <article class="fixed">
<a
onclick="_hmt.push(['_trackEvent', '交互', '点击github', '悬浮'])"
href="https://github.com/any86/any-rule"
target="_blank"
class="github"
>
<svg height="20" viewBox="0 0 16 16" version="1.1" width="20" aria-hidden="true">
<path
fill-rule="evenodd"
d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"
></path>
</svg>
<span>github</span>
</a>
<a <a
onclick="_hmt.push(['_trackEvent', '交互', '提问'])" onclick="_hmt.push(['_trackEvent', '交互', '提问'])"
class="message" class="message"
href="https://github.com/any86/any-rule/issues/new" href="https://github.com/any86/any-rule/issues/new"
target="_blank" target="_blank"
>提问</a> ><svg
style="margin-right: 8px"
height="24"
width="24"
viewBox="0 0 16 16"
version="1.1"
aria-hidden="true"
>
<path
fill-rule="evenodd"
fill="#fff"
d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"
></path>
</svg>
提问</a
>
</article> </article>
<header> <header>
<h1>正则大全</h1>
<a <a
onclick="_hmt.push(['_trackEvent', '交互', '点击github', '头部'])" onclick="_hmt.push(['_trackEvent', '交互', '点击github', '头部'])"
style="margin-left:15px;color:#000;"
href="https://github.com/any86/any-rule" href="https://github.com/any86/any-rule"
target="_blank" target="_blank"
class="github" class="github"
> >
<svg height="20" viewBox="0 0 16 16" version="1.1" width="20" aria-hidden="true"> <!-- <svg height="32" viewBox="0 0 16 16" version="1.1" width="32" aria-hidden="true">
<path <path
fill-rule="evenodd" fill-rule="evenodd"
d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"
></path> ></path>
</svg> </svg> -->
<span>github</span> <h1>🦕正则大全</h1>
</a> </a>
<iframe style="display:block;margin-top:15px;" src="https://ghbtns.com/github-btn.html?user=any86&repo=any-rule&type=star&count=true" frameborder="0" scrolling="0" width="170px" height="20px"></iframe> <iframe
style="display: block; margin-top: 15px"
src="https://ghbtns.com/github-btn.html?user=any86&repo=any-rule&type=star&count=true"
frameborder="0"
scrolling="0"
width="170px"
height="20px"
></iframe>
<input <input
ref="searchInput" ref="searchInput"
@ -53,27 +58,28 @@
class="search-input" class="search-input"
placeholder="搜索关键词, 如'手机'" placeholder="搜索关键词, 如'手机'"
type="text" type="text"
> />
</header> </header>
<article> <article>
<ul v-if="0 < rules.length" class="list"> <ul v-if="0 < rules.length" class="list">
<li <li
@mouseenter="mouseenterHandler(index)" @mouseenter="mouseenterHandler(index)"
v-for="({title, rule, events,examples,counterExamples}, index) in rules" v-for="({ title, rule, events, examples, counterExamples }, index) in rules"
:key="title" :key="title"
class="row" class="row"
> >
<i class="border"></i> <i class="border"></i>
<h2>{{title}}</h2> <h2>{{ title }}</h2>
<p class="rule"> <p class="rule">
<span :data-clipboard-text="rule" class="btn-copy">点击复制</span> <span :data-clipboard-text="rule" class="btn-copy">点击复制</span>
<a <a
:href="`https://github.com/any86/any-rule/issues/new?title=我有更好的正则: ${title}`" :href="`https://github.com/any86/any-rule/issues/new?title=我有更好的正则: ${title}`"
target="_blank" target="_blank"
class="btn-better" class="btn-better"
>我有更好的正则</a> >我有更好的正则</a
<code ref="code" class="javascript">{{rule}}</code> >
<code ref="code" class="javascript">{{ rule }}</code>
</p> </p>
<section class="verification"> <section class="verification">
<label> <label>
@ -87,7 +93,7 @@
@compositionend="check(index, 'blur')" @compositionend="check(index, 'blur')"
@blur="check(index, 'blur')" @blur="check(index, 'blur')"
@keyup="check(index, 'keyup')" @keyup="check(index, 'keyup')"
> />
<span class="btn-clear" @click="reset(index)">清空</span> <span class="btn-clear" @click="reset(index)">清空</span>
</label> </label>
@ -101,13 +107,9 @@
<section class="trigger"> <section class="trigger">
<h3>验证时机</h3> <h3>验证时机</h3>
<label> <label> <input v-model="list[index].events.blur" type="checkbox" /> blur </label>
<input v-model="list[index].events.blur" type="checkbox"> blur
</label>
<label> <label> <input v-model="list[index].events.keyup" type="checkbox" /> keyup </label>
<input v-model="list[index].events.keyup" type="checkbox"> keyup
</label>
</section> </section>
</li> </li>
</ul> </ul>
@ -128,7 +130,7 @@ export default {
Object.freeze(RULES); Object.freeze(RULES);
return { return {
token:'', token: '',
timer: null, timer: null,
keyword: '', keyword: '',
rules: RULES, rules: RULES,
@ -137,9 +139,9 @@ export default {
isOk: undefined, isOk: undefined,
events: { events: {
blur: true, blur: true,
keyup: true keyup: true,
} },
})) })),
}; };
}, },
@ -173,9 +175,9 @@ export default {
}, },
methods: { methods: {
parseExample(examples, counterExamples){ parseExample(examples, counterExamples) {
let arr = [`例如: ${examples.join(', ')}`]; let arr = [`例如: ${examples.join(', ')}`];
if(undefined !== counterExamples) { if (undefined !== counterExamples) {
arr.push(`反例: ${counterExamples.join(', ')}`); arr.push(`反例: ${counterExamples.join(', ')}`);
} }
return arr.join(' , '); return arr.join(' , ');
@ -183,7 +185,7 @@ export default {
search() { search() {
if ('' !== this.keyword) { if ('' !== this.keyword) {
this.rules = this.rules.filter(({ title }) => -1 !== title.indexOf(this.keyword.toLowerCase())); this.rules = this.rules.filter(({ title }) => -1 !== title.toLowerCase().indexOf(this.keyword.toLowerCase()));
} else { } else {
this.rules = RULES; this.rules = RULES;
} }
@ -225,8 +227,8 @@ export default {
/* eslint-disable */ /* eslint-disable */
_hmt.push(['_trackEvent', 'input框', this.rules[index].title, this.list[index].value]); _hmt.push(['_trackEvent', 'input框', this.rules[index].title, this.list[index].value]);
} }
} },
} },
}; };
</script> </script>
@ -271,18 +273,17 @@ main {
z-index: 1986; z-index: 1986;
right: 15px; right: 15px;
bottom: 15px; bottom: 15px;
box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.1);
border-radius: $radius;
overflow: hidden;
> a { > a {
display: flex; display: flex;
border-radius: $radius;
align-content: center; align-content: center;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
justify-items: center; justify-items: center;
font-size: 16px; font-size: 16px;
text-align: center; text-align: center;
padding: 15px; padding: 16px;
box-shadow: 1px 2px 3px 1px rgba(0, 0, 0, 0.1);
&:active { &:active {
opacity: 0.6; opacity: 0.6;
box-shadow: none; box-shadow: none;
@ -306,6 +307,10 @@ main {
header { header {
padding: 15px; padding: 15px;
position: sticky;
top: 0;
z-index: 99;
background: linear-gradient(180deg, white 80%, transparent);
> .search-input { > .search-input {
display: block; display: block;
margin-top: 15px; margin-top: 15px;
@ -316,12 +321,15 @@ main {
border-radius: $radius; border-radius: $radius;
box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.1); box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.1);
} }
h1 {
display: inline-block; //
} > .github {
>.github{display: inline-flex; display: inline-flex;
>span{ align-items: center;
margin-left: 5px; color: #000;
h1 {
margin-left: 8px;
} }
} }
} }
@ -336,7 +344,7 @@ main {
border-color: #eee; border-color: #eee;
border-width: 1px; border-width: 1px;
border-style: solid; border-style: solid;
box-shadow: 1px 2px 5px 1px rgba(0, 0, 0, 0.1);
> .border { > .border {
position: absolute; position: absolute;
background: $primary; background: $primary;
@ -350,6 +358,7 @@ main {
transition: all 600ms; transition: all 600ms;
border-radius: $radius; border-radius: $radius;
border-color: #eee; border-color: #eee;
box-shadow: none;
> .border { > .border {
animation: shrinkBorder 0.5s; animation: shrinkBorder 0.5s;
left: 0; left: 0;
@ -366,11 +375,12 @@ main {
display: inline-block; display: inline-block;
border-radius: $radius; border-radius: $radius;
margin-right: 15px; margin-right: 15px;
padding:0 5px; padding: 0 5px;
background: $primary; background: $primary;
color: #fff; color: #fff;
font-size: 12px; font-size: 12px;
cursor: pointer; cursor: pointer;
box-shadow: 1px 2px 3px $primary;
&.success { &.success {
&:after { &:after {
content: '复制成功'; content: '复制成功';
@ -385,20 +395,24 @@ main {
} }
&:active { &:active {
opacity: 0.6; opacity: 0.6;
color: #444; box-shadow: none;
} }
&:hover { &:hover {
opacity: 0.6; transition: all 0.3s;
color: rgba(255, 255, 255, 0.6)
} }
} }
> .btn-better { > .btn-better {
@extend .btn-copy; @extend .btn-copy;
background-color: $danger; background-color: $danger;
box-shadow: 1px 2px 3px $danger;
} }
>code{word-break:break-word;} > code {
word-break: break-word;
}
} }
> section.verification { > section.verification {
@ -413,6 +427,7 @@ main {
border: 1px solid #ddd; border: 1px solid #ddd;
font-size: 16px; font-size: 16px;
& + .btn-clear { & + .btn-clear {
cursor: pointer;
padding: 5px; padding: 5px;
color: #000; color: #000;
display: inline-block; display: inline-block;

View File

@ -1,329 +1,457 @@
module.exports = [{ module.exports = [{
title: '火车车次', title: '火车车次',
rule: /^[GCDZTSPKXLY1-9]\d{1,4}$/, rule: /^[GCDZTSPKXLY1-9]\d{1,4}$/,
examples: ['G1868', 'D102', 'D9', 'Z5', 'Z24', 'Z17'] examples: ['G1868', 'D102', 'D9', 'Z5', 'Z24', 'Z17']
}, },
{ {
title: '手机机身码(IMEI)', title: '手机机身码(IMEI)',
rule: /^\d{15,17}$/, rule: /^\d{15,17}$/,
examples: ['123456789012345', '1234567890123456', '12345678901234567'] examples: ['123456789012345', '1234567890123456', '12345678901234567']
}, },
{ {
title: '必须带端口号的网址(或ip)', title: '必须带端口号的网址(或ip)',
rule: /^((ht|f)tps?:\/\/)?[\w-]+(\.[\w-]+)+:\d{1,5}\/?$/, rule: /^((ht|f)tps?:\/\/)?[\w-]+(\.[\w-]+)+:\d{1,5}\/?$/,
examples: ['https://www.qq.com:8080', '127.0.0.1:5050', 'baidu.com:8001', 'http://192.168.1.1:9090'], examples: ['https://www.qq.com:8080', '127.0.0.1:5050', 'baidu.com:8001', 'http://192.168.1.1:9090'],
counterExamples: ['192.168.1.1', 'https://www.jd.com'] counterExamples: ['192.168.1.1', 'https://www.jd.com']
}, },
{ {
title: '网址(url,支持端口和"?+参数"和"#+参数)', // 参考:
rule: /^(((ht|f)tps?):\/\/)?[\w-]+(\.[\w-]+)+([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?$/, // https://baike.baidu.com/item/%E9%A1%B6%E7%BA%A7%E5%9F%9F%E5%90%8D#4_1
examples: ['www.qq.com', 'https://baidu.com', '360.com:8080/vue/#/a=1&b=2'], // https://baike.baidu.com/item/%E9%A1%B6%E7%BA%A7%E5%9F%9F%E5%90%8D#7
counterExamples: ['....'] // 也参考谷歌浏览器的地址栏, 如果输入非字母不会被识别为域名
}, title: '网址(URL)',
{ rule: /^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,
title: '统一社会信用代码', examples: ['www.qq.com', 'https://vuejs.org/v2/api/#v-model', 'www.qq.99', '//www.qq.com', 'www.腾讯.cs', 'ftp://baidu.qq', 'http://baidu.com', 'https://www.amap.com/search?id=BV10060895&city=420111&geoobj=113.207951%7C29.992557%7C115.785782%7C31.204369&query_type=IDQ&query=%E5%85%89%E8%B0%B7%E5%B9%BF%E5%9C%BA(%E5%9C%B0%E9%93%81%E7%AB%99)&zoom=10.15', '360.com:8080/vue/#/a=1&b=2'],
rule: /^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/, counterExamples: ['....']
examples: ['91230184MA1BUFLT44', '92371000MA3MXH0E3W'], },
}, {
title: '统一社会信用代码',
rule: /^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/,
examples: ['91230184MA1BUFLT44', '92371000MA3MXH0E3W'],
},
{
title: '统一社会信用代码(宽松匹配)(15位/18位/20位数字/字母)',
rule: /^(([0-9A-Za-z]{15})|([0-9A-Za-z]{18})|([0-9A-Za-z]{20}))$/,
examples: ['91110108772551611J', '911101085923662400']
},
{
title: '迅雷链接',
rule: /^thunderx?:\/\/[a-zA-Z\d]+=$/,
examples: ['thunder://QUEsICdtYWduZXQ6P3h0PXVybjpidGloOjBCQTE0RTUxRkUwNjU1RjE0Qzc4NjE4RjY4NDY0QjZFNTEyNjcyOUMnWlo='],
},
{ {
title: '迅雷链接', title: 'ed2k链接(宽松匹配)',
rule: /^thunderx?:\/\/[a-zA-Z\d]+=$/, rule: /^ed2k:\/\/\|file\|.+\|\/$/,
examples: ['thunder://QUEsICdtYWduZXQ6P3h0PXVybjpidGloOjBCQTE0RTUxRkUwNjU1RjE0Qzc4NjE4RjY4NDY0QjZFNTEyNjcyOUMnWlo='], examples: ['ed2k://|file|%E5%AF%84%E7%94%9F%E8%99%AB.PARASITE.2019.HD-1080p.X264.AAC-UUMp4(ED2000.COM).mp4|2501554832|C0B93E0879C6071CBED732C20CE577A3|h=5HTKZPQFYRKORN52I3M7GQ4QQCIHFIBV|/'],
}, },
{ {
title: 'ed2k链接(宽松匹配)', title: '磁力链接(宽松匹配)',
rule: /^ed2k:\/\/\|file\|.+\|\/$/, rule: /^magnet:\?xt=urn:btih:[0-9a-fA-F]{40,}.*$/,
examples: ['ed2k://|file|%E5%AF%84%E7%94%9F%E8%99%AB.PARASITE.2019.HD-1080p.X264.AAC-UUMp4(ED2000.COM).mp4|2501554832|C0B93E0879C6071CBED732C20CE577A3|h=5HTKZPQFYRKORN52I3M7GQ4QQCIHFIBV|/'], examples: ['magnet:?xt=urn:btih:40A89A6F4FB1498A98087109D012A9A851FBE0FC'],
}, },
{
title: '子网掩码(不包含 0.0.0.0)',
rule: /^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(255|254|252|248|240|224|192|128|0)$/,
examples: ['255.255.255.0', '255.255.255.255', '255.240.0.0']
},
{
title: 'linux"隐藏文件"路径',
rule: /^\/(?:[^/]+\/)*\.[^/]*/,
examples: ['/usr/ad/.dd', '/root/.gitignore', '/.gitignore']
},
{
title: 'linux文件夹路径',
rule: /^\/(?:[^/]+\/)*$/,
examples: ['/usr/ad/dd/', '/', '/root/', '/ a a / a / a a /']
},
{
title: 'linux文件路径',
rule: /^\/(?:[^/]+\/)*[^/]+$/,
examples: ['/root/b.ts', '/root/abc']
},
{
title: 'window"文件夹"路径',
rule: /^[a-zA-Z]:\\(?:\w+\\?)*$/,
examples: ['C:\\Users\\Administrator\\Desktop', 'e:\\m\\']
},
{
title: 'window下"文件"路径',
rule: /^[a-zA-Z]:\\(?:\w+\\)*\w+\.\w+$/,
examples: ['C:\\Users\\Administrator\\Desktop\\qq.link', 'e:\\m\\vscode.exe']
},
{
title: '股票代码(A股)',
rule: /^(s[hz]|S[HZ])(000[\d]{3}|002[\d]{3}|300[\d]{3}|600[\d]{3}|60[\d]{4})$/,
examples: ['sz000858', 'SZ002136', 'sz300675', 'SH600600', 'sh601155']
},
{
title: '大于等于0, 小于等于150, 支持小数位出现5, 如145.5, 用于判断考卷分数',
rule: /^150$|^(?:\d|[1-9]\d|1[0-4]\d)(?:\.5)?$/,
examples: [150, 100.5]
},
{
title: 'html注释',
rule: /<!--[\s\S]*?-->/g,
examples: ['<!--<div class="_bubble"></div>--><div>chenguzhen87</div><div class="_bubble"></div>-->']
},
{
title: 'md5格式(32位)',
rule: /^[a-fA-F0-9]{32}$/,
examples: ['21fe181c5bfc16306a6828c1f7b762e8'],
},
{
title: 'GUID/UUID',
rule: /^[a-f\d]{4}(?:[a-f\d]{4}-){4}[a-f\d]{12}$/i,
examples: ['e155518c-ca1b-443c-9be9-fe90fdab7345', '41E3DAF5-6E37-4BCC-9F8E-0D9521E2AA8D', '00000000-0000-0000-0000-000000000000'],
},
{
title: '版本号(version)格式必须为X.Y.Z',
rule: /^\d+(?:\.\d+){2}$/,
examples: ['16.3.10']
},
{
title: '视频(video)链接地址(视频格式可按需增删)',
rule: /^https?:\/\/(.+\/)+.+(\.(swf|avi|flv|mpg|rm|mov|wav|asf|3gp|mkv|rmvb|mp4))$/i,
examples: ['http://www.abc.com/video/wc.avi']
},
{
title: '图片(image)链接地址(图片格式可按需增删)',
rule: /^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i,
examples: ['https://www.abc.com/logo.png', 'http://www.abc.com/logo.png']
},
{
title: '24小时制时间HH:mm:ss',
rule: /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/,
examples: ['23:34:55']
},
{
title: '12小时制时间hh:mm:ss',
rule: /^(?:1[0-2]|0?[1-9]):[0-5]\d:[0-5]\d$/,
examples: ['11:34:55'],
counterExamples: ['23:34:55']
},
{
title: 'base64格式',
rule: /^\s*data:(?:[a-z]+\/[a-z0-9-+.]+(?:;[a-z-]+=[a-z0-9-]+)?)?(?:;base64)?,([a-z0-9!$&',()*+;=\-._~:@/?%\s]*?)\s*$/i,
examples: ['data:image/gif;base64,xxxx==']
},
{
title: '数字/货币金额(支持负数、千分位分隔符)',
rule: /^-?\d{1,3}(,\d{3})*(\.\d{1,2})?$/ ,
examples: [100, -0.99, 3, 234.32, -1, 900, 235.09, '12,345,678.90']
},
{
title: '银行卡号10到30位, 覆盖对公/私账户, 参考[微信支付](https://pay.weixin.qq.com/wiki/doc/api/xiaowei.php?chapter=22_1)',
rule: /^[1-9]\d{9,29}$/,
examples: [6234567890, 6222026006705354217]
},
{
title: '中文姓名',
rule: /^(?:[\u4e00-\u9fa5·]{2,16})$/,
examples: ['葛二蛋', '凯文·杜兰特', '德克·维尔纳·诺维茨基']
},
{
title: '英文姓名',
rule: /(^[a-zA-Z][a-zA-Z\s]{0,20}[a-zA-Z]$)/,
examples: ['James', 'Kevin Wayne Durant', 'Dirk Nowitzki']
},
{
title: '车牌号(新能源)',
rule: /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z](([DF]((?![IO])[a-zA-Z0-9](?![IO]))[0-9]{4})|([0-9]{5}[DF]))$/,
examples: ['京AD92035', '甘G23459F', '京A19203D'],
},
{
title: '车牌号(非新能源)',
rule: /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]$/,
examples: ['京A00599', '黑D23908']
},
{
title: '车牌号(新能源+非新能源)',
rule: /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]$/,
examples: ['京A12345D', '京A00599', '京AD92035', '甘G23459F', '京AA92035'],
counterExamples: ['宁AD1234555555', '浙苏H6F681']
},
{
title: '手机号(mobile phone)中国(严谨), 根据工信部最新公布的手机号段',
rule: /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[01256789]))\d{8}$/,
examples: ['008618311006933', '+8617888829981', '19119255642', '19519255642']
},
{
title: '手机号(mobile phone)中国(宽松), 只要是13,14,15,16,17,18,19开头即可',
rule: /^(?:(?:\+|00)86)?1[3-9]\d{9}$/,
examples: ['008618311006933', '+8617888829981', '19119255642']
},
{
title: '手机号(mobile phone)中国(最宽松), 只要是1开头即可, 如果你的手机号是用来接收短信, 优先建议选择这一条',
rule: /^(?:(?:\+|00)86)?1\d{10}$/,
examples: ['008618311006933', '+8617888829981', '19119255642']
},
{
title: '日期(宽松)',
rule: /^\d{1,4}(-)(1[0-2]|0?[1-9])\1(0?[1-9]|[1-2]\d|30|31)$/,
examples: ['1990-12-12', '1-1-1', '0000-1-1'],
counterExamples: ['2020-00-01']
},
{ {
title: '磁力链接(宽松匹配)', title: '日期(严谨, 支持闰年判断)',
rule: /^magnet:\?xt=urn:btih:[0-9a-fA-F]{40,}.*$/, rule: /^(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)$/,
examples: ['magnet:?xt=urn:btih:40A89A6F4FB1498A98087109D012A9A851FBE0FC'], examples: ['1990-12-12', '2000-02-29'],
}, counterExamples: ['2021-02-29']
{ },
title: '子网掩码',
rule: /^(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])(?:\.(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])){3}$/, {
examples: ['255.255.255.0', '255.224.0.0'] title: '中国省',
}, rule: /^浙江|上海|北京|天津|重庆|黑龙江|吉林|辽宁|内蒙古|河北|新疆|甘肃|青海|陕西|宁夏|河南|山东|山西|安徽|湖北|湖南|江苏|四川|贵州|云南|广西|西藏|江西|广东|福建|台湾|海南|香港|澳门$/,
{ examples: ['浙江', '台湾'],
title: 'linux"隐藏文件"路径', counterExamples: ['哈尔滨']
rule: /^\/(?:[^/]+\/)*\.[^/]*/, },
examples: ['/usr/ad/.dd', '/root/.gitignore', '/.gitignore']
}, {
{ title: '可以被moment转化成功的时间 YYYYMMDD HH:mm:ss',
title: 'linux文件夹路径', rule: /^\d{4}([/:-\S])(1[0-2]|0?[1-9])\1(0?[1-9]|[1-2]\d|30|31) (?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/,
rule: /^\/(?:[^/]+\/)*$/, examples: ['2020/01/01 23:59:59', '2020-01-01 00:00:00', '20200101 11:11:11'],
examples: ['/usr/ad/dd/', '/', '/root/'] counterExamples: ['2020/00/01 23:59:59', '2020-01/01 23:59:59', '2020-01-01 23:59:61', '2020-01-0100:00:00',]
}, },
{ {
title: 'linux文件路径', title: 'email(邮箱)',
rule: /^\/(?:[^/]+\/)*[^/]+$/, rule: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
examples: ['/root/b.ts', '/root/abc'] examples: ['90203918@qq.com', 'nbilly@126.com', '汉字@qq.com']
}, },
{
title: 'window"文件夹"路径', {
rule: /^[a-zA-Z]:\\(?:\w+\\?)*$/, title: '座机(tel phone)电话(国内),如: 0341-86091234',
examples: ['C:\\Users\\Administrator\\Desktop', 'e:\\m\\'] rule: /^(?:(?:\d{3}-)?\d{8}|^(?:\d{4}-)?\d{7,8})(?:-\d+)?$/,
}, examples: ['0936-4211235', '89076543', '010-12345678-1234']
{ },
title: 'window下"文件"路径',
rule: /^[a-zA-Z]:\\(?:\w+\\)*\w+\.\w+$/, {
examples: ['C:\\Users\\Administrator\\Desktop\\qq.link', 'e:\\m\\vscode.exe'] title: '身份证号(1代,15位数字)',
}, rule: /^[1-9]\d{7}(?:0\d|10|11|12)(?:0[1-9]|[1-2][\d]|30|31)\d{3}$/,
{ examples: ['123456991010193']
title: '股票代码(A股)', },
rule: /^(s[hz]|S[HZ])(000[\d]{3}|002[\d]{3}|300[\d]{3}|600[\d]{3}|60[\d]{4})$/, {
examples: ['sz000858', 'SZ002136', 'sz300675', 'SH600600', 'sh601155'] title: '身份证号(2代,18位数字),最后一位是校验位,可能为数字或字符X',
}, rule: /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/,
{ examples: ['12345619991205131x']
title: '大于等于0, 小于等于150, 支持小数位出现5, 如145.5, 用于判断考卷分数', },
rule: /^150$|^(?:\d|[1-9]\d|1[0-4]\d)(?:.5)?$/, {
examples: [150, 100.5] title: '身份证号, 支持1/2代(15位/18位数字)',
}, rule: /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/,
{ examples: ['622223199912051311', '12345619991205131x', '123456991010193']
title: 'html注释', },
rule: /^<!--[\s\S]*?-->$/, {
examples: ['<!--<div class="_bubble"></div>-->'] title: '护照(包含香港、澳门)',
}, rule: /(^[EeKkGgDdSsPpHh]\d{8}$)|(^(([Ee][a-fA-F])|([DdSsPp][Ee])|([Kk][Jj])|([Mm][Aa])|(1[45]))\d{7}$)/,
{ examples: ['s28233515', '141234567', '159203084', 'MA1234567', 'K25345719']
title: 'md5格式(32位)', },
rule: /^([a-f\d]{32}|[A-F\d]{32})$/, {
examples: ['21fe181c5bfc16306a6828c1f7b762e8'], title: '帐号是否合法(字母开头允许5-16字节允许字母数字下划线组合',
}, rule: /^[a-zA-Z]\w{4,15}$/,
{ examples: ['justin', 'justin1989', 'justin_666']
title: '版本号(version)格式必须为X.Y.Z', },
rule: /^\d+(?:\.\d+){2}$/, {
examples: ['16.3.10'] title: '中文/汉字',
}, // rule: /^[\u4E00-\u9FA5]+$/,
{ rule: /^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/,
title: '视频(video)链接地址(视频格式可按需增删)', examples: ['正则', '前端']
rule: /^https?:\/\/(.+\/)+.+(\.(swf|avi|flv|mpg|rm|mov|wav|asf|3gp|mkv|rmvb|mp4))$/i, },
examples: ['http://www.abc.com/video/wc.avi'] {
}, title: '小数(支持科学计数)',
{ rule: /^[+-]?(\d+([.]\d*)?([eE][+-]?\d+)?|[.]\d+([eE][+-]?\d+)?)$/,
title: '图片(image)链接地址(图片格式可按需增删)', examples: ['0.0', '0.09','4E+4']
rule: /^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i, },
examples: ['https://www.abc.com/logo.png'] {
}, title: '只包含数字',
{ rule: /^\d+$/,
title: '24小时制时间HH:mm:ss', examples: [12345678]
rule: /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/, },
examples: ['23:34:55'] {
}, title: 'html标签(宽松匹配)',
{ rule: /<(\w+)[^>]*>(.*?<\/\1>)?/,
title: '12小时制时间hh:mm:ss', examples: ['<div id="app"> 2333 </div>', '<input type="text">', '<br>']
rule: /^(?:1[0-2]|0?[1-9]):[0-5]\d:[0-5]\d$/, },
examples: ['11:34:55'],
counterExamples: ['23:34:55'] {
}, title: '匹配中文汉字和中文标点',
{ rule: /[\u4e00-\u9fa5|\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]/,
title: 'base64格式', examples: ["匹配中文汉字以及中文标点符号 。 “ ” ' 《 》 〈 〉 【 】 『 』 「 」 ﹃ ﹄ … — ¥"]
rule: /^\s*data:(?:[a-z]+\/[a-z0-9-+.]+(?:;[a-z-]+=[a-z0-9-]+)?)?(?:;base64)?,([a-z0-9!$&',()*+;=\-._~:@/?%\s]*?)\s*$/i, },
examples: ['data:image/gif;base64,xxxx==']
}, {
{ title: 'qq号格式正确',
title: '数字/货币金额(支持负数、千分位分隔符)', rule: /^[1-9][0-9]{4,10}$/,
rule: /^-?\d+(,\d{3})*(\.\d{1,2})?$/, examples: [903013545, 9020304]
examples: [100, -0.99, 3, 234.32, -1, 900, 235.09, '12,345,678.90'] },
}, {
{ title: '数字和字母组成',
title: '数字/货币金额 (只支持正数、不支持校验千分位分隔符)', rule: /^[A-Za-z0-9]+$/,
rule: /(?:^[1-9]([0-9]+)?(?:\.[0-9]{1,2})?$)|(?:^(?:0){1}$)|(?:^[0-9]\.[0-9](?:[0-9])?$)/, examples: ['james666', 'haha233hi']
examples: [0.99, 8.99, 666] },
}, {
{ title: '英文字母',
title: '银行卡号10到30位, 覆盖对公/私账户, 参考[微信支付](https://pay.weixin.qq.com/wiki/doc/api/xiaowei.php?chapter=22_1)', rule: /^[a-zA-Z]+$/,
rule: /^[1-9]\d{9,29}$/, examples: ['Russel']
examples: [6234567890, 6222026006705354217] },
}, {
{ title: '小写英文字母组成',
title: '中文姓名', rule: /^[a-z]+$/,
rule: /^(?:[\u4e00-\u9fa5·]{2,16})$/, examples: ['russel']
examples: ['葛二蛋', '凯文·杜兰特', '德克·维尔纳·诺维茨基'] },
}, {
{ title: '大写英文字母',
title: '英文姓名', rule: /^[A-Z]+$/,
rule: /(^[a-zA-Z]{1}[a-zA-Z\s]{0,20}[a-zA-Z]{1}$)/, examples: ['ABC', 'KD']
examples: ['James', 'Kevin Wayne Durant', 'Dirk Nowitzki'] },
}, {
{ title: '密码强度校验最少6位包括至少1个大写字母1个小写字母1个数字1个特殊字符',
title: '车牌号(新能源)', rule: /^\S*(?=\S{6,})(?=\S*\d)(?=\S*[A-Z])(?=\S*[a-z])(?=\S*[!@#$%^&*? ])\S*$/,
rule: /[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-HJ-NP-Z]{1}(([0-9]{5}[DF])|([DF][A-HJ-NP-Z0-9][0-9]{4}))$/, examples: ['Kd@curry666']
examples: ['京AD92035', '甘G23459F'], },
}, {
{ title: '用户名校验4到16位字母数字下划线减号',
title: '车牌号(非新能源)', rule: /^[\w-]{4,16}$/,
rule: /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-HJ-NP-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/, examples: ['xiaohua_qq']
examples: ['京A00599', '黑D23908'] },
}, {
{ title: 'ip-v4[:端口]',
title: '车牌号(新能源+非新能源)', rule: /^((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$/,
rule: /^(?:[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-HJ-NP-Z]{1}(?:(?:[0-9]{5}[DF])|(?:[DF](?:[A-HJ-NP-Z0-9])[0-9]{4})))$|(?:[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9 挂学警港澳]{1})$/, examples: ['172.16.0.0', '172.16.0.0:8080', '127.0.0.0', '127.0.0.0:998']
examples: ['京A12345D', '京A00599'], },
counterExamples: ['宁AD1234555555'] {
}, title: 'ip-v6[:端口]',
{ rule: /(^(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$)|(^\[(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))\](?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$)/i,
title: '手机号(mobile phone)中国(严谨), 根据工信部2019年最新公布的手机号段', examples: ['2031:0000:130f:0000:0000:09c0:876a:130b', '[2031:0000:130f:0000:0000:09c0:876a:130b]:8080']
rule: /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-7|9])|(?:5[0-3|5-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[1|8|9]))\d{8}$/, },
examples: ['008618311006933', '+8617888829981', '19119255642'] {
}, title: '16进制颜色',
{ rule: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3}|[a-fA-F0-9]{8}|[a-fA-F0-9]{4})$/,
title: '手机号(mobile phone)中国(宽松), 只要是13,14,15,16,17,18,19开头即可', examples: ['#f00', '#F90', '#000', '#fe9de8', '#f8f8f8ff', '#f003']
rule: /^(?:(?:\+|00)86)?1[3-9]\d{9}$/, },
examples: ['008618311006933', '+8617888829981', '19119255642'] {
}, title: '微信号(wx)6至20位以字母开头字母数字减号下划线',
{ rule: /^[a-zA-Z][-_a-zA-Z0-9]{5,19}$/,
title: '手机号(mobile phone)中国(最宽松), 只要是1开头即可, 如果你的手机号是用来接收短信, 优先建议选择这一条', examples: ['github666', 'kd_-666']
rule: /^(?:(?:\+|00)86)?1\d{10}$/, },
examples: ['008618311006933', '+8617888829981', '19119255642'] {
}, 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}$/,
title: 'date(日期)', examples: ['734500', '100101']
rule: /^\d{4}(-)(1[0-2]|0?\d)\1([0-2]\d|\d|30|31)$/, },
examples: ['1990-12-12', '2020-1-1'] {
}, title: '中文和数字',
{ rule: /^((?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])|(\d))+$/,
title: 'email(邮箱)', examples: ['哈哈哈', '你好6啊']
rule: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, },
examples: ['90203918@qq.com', 'nbilly@126.com'] {
}, title: '不能包含字母',
{ rule: /^[^A-Za-z]*$/,
title: '座机(tel phone)电话(国内),如: 0341-86091234', examples: ['你好6啊', '@¥()']
rule: /^\d{3}-\d{8}$|^\d{4}-\d{7,8}$/, },
examples: ['0936-4211235'] {
}, title: 'java包名',
{ rule: /^([a-zA-Z_]\w*)+([.][a-zA-Z_]\w*)+$/,
title: '身份证号(1代,15位数字)', examples: ['com.bbb.name']
rule: /^[1-9]\d{7}(?:0\d|10|11|12)(?:0[1-9]|[1-2][\d]|30|31)\d{3}$/, },
examples: ['123456991010193'] {
}, title: 'mac地址',
{ rule: /^(([a-f0-9][0,2,4,6,8,a,c,e]:([a-f0-9]{2}:){4})|([a-f0-9][0,2,4,6,8,a,c,e]-([a-f0-9]{2}-){4}))[a-f0-9]{2}$/i,
title: '身份证号(2代,18位数字),最后一位是校验位,可能为数字或字符X', examples: ['38:f9:d3:4b:f5:51', '00-0C-29-CA-E4-66']
rule: /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/, },
examples: ['12345619991205131x'] {
}, title: '匹配连续重复的字符',
{ rule: /(.)\1+/,
title: '身份证号, 支持1/2代(15位/18位数字)', examples: ['我我我', '112233', '11234']
rule: /(^\d{8}(0\d|10|11|12)([0-2]\d|30|31)\d{3}$)|(^\d{6}(18|19|20)\d{2}(0[1-9]|10|11|12)([0-2]\d|30|31)\d{3}(\d|X|x)$)/, },
examples: ['622223199912051311'] {
}, title: '数字和英文字母组成,并且同时含有数字和英文字母',
{ rule: /^(?=.*[a-zA-Z])(?=.*\d).+$/,
title: '护照(包含香港、澳门)', examples: ['我a我1我', 'a对1']
rule: /(^[EeKkGgDdSsPpHh]\d{8}$)|(^(([Ee][a-fA-F])|([DdSsPp][Ee])|([Kk][Jj])|([Mm][Aa])|(1[45]))\d{7}$)/, },
examples: ['s28233515', '141234567', '159203084', 'MA1234567', 'K25345719'] {
}, title: '香港身份证 ',
{ rule: /^[a-zA-Z]\d{6}\([\dA]\)$/,
title: '帐号是否合法(字母开头允许5-16字节允许字母数字下划线组合', examples: ['K034169(1)']
rule: /^[a-zA-Z]\w{4,15}$/, },
examples: ['justin', 'justin1989', 'justin_666'] {
}, // 参考:
{ // https://baike.baidu.com/item/%E6%BE%B3%E9%97%A8%E5%B1%85%E6%B0%91%E8%BA%AB%E4%BB%BD%E8%AF%81/12509098?fr=aladdin#5
title: '中文/汉字', title: '澳门身份证 ',
// rule: /^[\u4E00-\u9FA5]+$/, rule: /^[1|5|7]\d{6}\(\d\)$/,
rule: /^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/, examples: ['5686611(1)']
examples: ['正则', '前端'] },
}, {
{ title: '台湾身份证 ',
title: '小数', rule: /^[a-zA-Z][0-9]{9}$/,
rule: /^\d+\.\d+$/, examples: ['U193683453']
examples: ['0.0', '0.09'] },
}, {
{ title: '大写字母,小写字母,数字,特殊符号 `@#$%^&*`~()-+=` 中任意3项密码',
title: '数字', rule: /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]/,
rule: /^\d{1,}$/, examples: ['a1@', 'A1@', 'Aa@']
examples: [12345678] },
}, {
{ title: 'ASCII码表中的全部的特殊字符',
title: 'html标签(宽松匹配)', rule: /[\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]+/,
rule: /<(\w+)[^>]*>(.*?<\/\1>)?/, examples: ["[", ".", "^", "&3%"]
examples: ['<div id="app"> 2333 </div>', '<input type="text">', '<br>'] },
}, {
{ title: '正整数不包含0',
title: 'qq号格式正确', rule: /^\+?[1-9]\d*$/,
rule: /^[1-9][0-9]{4,10}$/, examples: [1231]
examples: [903013545, 9020304] },
}, {
{ title: '负整数不包含0',
title: '数字和字母组成', rule: /^-[1-9]\d*$/,
rule: /^[A-Za-z0-9]+$/, examples: [-1231]
examples: ['james666', 'haha233hi'] },
}, {
{ title: '整数',
title: '英文字母', rule: /^(?:0|(?:-?[1-9]\d*))$/,
rule: /^[a-zA-Z]+$/, examples: [-1231, 123, 0],
examples: ['Russel'] counterExamples: ['01']
}, },
{ {
title: '小写英文字母组成', title: '浮点数',
rule: /^[a-z]+$/, rule: /^(-?[1-9]\d*\.\d+|-?0\.\d*[1-9]\d*|0\.0+)$/,
examples: ['russel'] examples: ["1.23", "-1.01", "0.00"]
}, // allow "1.23", allow "-0.1", allow "0.00", ban "-0.00", ban "2.", allow "2.0"
{ },
title: '大写英文字母', {
rule: /^[A-Z]+$/, title: '浮点数(严格)',
examples: ['ABC', 'KD'] rule: /^(-?[1-9]\d*\.\d+|-?0\.\d*[1-9])$/,
}, examples: ["1.23", "-1.01"]
{ // allow "1.23", allow "-0.1", ban "2.", ban "2.0"
title: '密码强度校验最少6位包括至少1个大写字母1个小写字母1个数字1个特殊字符', },
rule: /^\S*(?=\S{6,})(?=\S*\d)(?=\S*[A-Z])(?=\S*[a-z])(?=\S*[!@#$%^&*? ])\S*$/, {
examples: ['Kd@curry666'] title: 'email(支持中文邮箱)',
}, rule: /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,
{ examples: ['90203918@qq.com', 'nbilly@126.com', '啦啦啦@126.com']
title: '用户名校验4到16位字母数字下划线减号', },
rule: /^[a-zA-Z0-9_-]{4,16}$/,
examples: ['xiaohua_qq'] {
}, title: '域名(非网址, 不包含协议)',
{ rule: /^([0-9a-zA-Z-]{1,}\.)+([a-zA-Z]{2,})$/,
title: 'ip-v4', examples: ['www.baidu.com',
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]?)$/, 'baidu.com',
examples: ['172.16.0.0', '127.0.0.0'] 'baidu.com.cn',
}, 'api.baidu.com',
{ 'nodejs.org',
title: 'ip-v6', 'nodejs.cn'],
rule: /^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i, counterExamples: ['http://baidu.com', 'https://baidu.com', 'www.百度.com']
examples: ['2031:0000:130f:0000:0000:09c0:876a:130b'] },
},
{ {
title: '16进制颜色', title: '军官/士兵证',
rule: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/, rule: /^[\u4E00-\u9FA5](字第)([0-9a-zA-Z]{4,8})(号?)$/,
examples: ['#f00', '#F90', '#000', '#fe9de8'] examples: ['军字第2001988号', '士字第P011816X号'],
}, },
{ {
title: '微信号(wx)6至20位以字母开头字母数字减号下划线', title: '户口薄',
rule: /^[a-zA-Z][-_a-zA-Z0-9]{5,19}$/, rule: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
examples: ['github666', 'kd_-666'] examples: ['441421999707223115'],
}, },
{
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}$/,
examples: ['734500', '100101']
},
{
title: '中文和数字',
rule: /^((?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])|(\d))+$/,
examples: ['哈哈哈', '你好6啊']
},
{
title: '不能包含字母',
rule: /^[^A-Za-z]*$/,
examples: ['你好6啊', '@¥()']
},
{
title: 'java包名',
rule: /^([a-zA-Z_][a-zA-Z0-9_]*)+([.][a-zA-Z_][a-zA-Z0-9_]*)+$/,
examples: ['com.bbb.name']
},
{
title: 'mac地址',
rule: /^((([a-f0-9]{2}:){5})|(([a-f0-9]{2}-){5}))[a-f0-9]{2}$/i,
examples: ['38:f9:d3:4b:f5:51', '00-0C-29-CA-E4-66']
},
{
title: '匹配连续重复的字符',
rule: /(.)\1+/,
examples: ['我我我', '112233', '11234']
}
];

View File

@ -1,5 +1,5 @@
module.exports = { module.exports = {
publicPath: process.env.NODE_ENV === 'production' // publicPath: process.env.NODE_ENV === 'production'
? '/any-rule/' // ? '/any-rule/'
: '/' // : '/'
} }

View File

@ -27,7 +27,7 @@ let content = `# 正则大全 ${badges.join(' ')}
🦕支持**web** / **vscode** / **idea** / **Alfred Workflow** 🦕支持**web** / **vscode** / **idea** / **Alfred Workflow**
## :rocket:web版本 ## :rocket:web版本
https://any86.github.io/any-rule/ https://any-rule.vercel.app/
## 🍭vscode插件 ## 🍭vscode插件
@ -40,40 +40,48 @@ vscode应用商店中搜索"**any-rule**".
1. **F1**(mac下fn+F1)打开正则列表. 1. **F1**(mac下fn+F1)打开正则列表.
2. **输入关键词搜索**, 比如"手机". 2. **输入关键词搜索**, 比如"手机".
![预览图](https://user-gold-cdn.xitu.io/2020/1/10/16f8e01a684a0a18?w=420&h=243&f=gif&s=414162) ![GIF](https://user-images.githubusercontent.com/8264787/146724787-888a8666-5d2a-4e5e-b383-aec7c53bd312.gif)
**方式2:** **方式2:**
右键选择"🦕正则大全". 右键选择"🦕正则大全".
![](https://user-gold-cdn.xitu.io/2020/2/28/17087735718cca3b?w=389&h=400&f=png&s=55934) ![GIF](https://user-images.githubusercontent.com/8264787/146725447-4d92caed-2dd0-4f11-91d1-8da9cd8ff08b.gif)
**方式3:** **方式3:**
在代码任意位置输入"**@zz**". 在代码任意位置输入"**@zz**".
![GIF](https://user-images.githubusercontent.com/8264787/146725402-30b34119-b709-4d49-adb2-af8dbb786d3b.gif)
![预览图](https://user-gold-cdn.xitu.io/2020/2/28/17089999afc7a21c?w=722&h=408&f=gif&s=299355)
## 👩🏫图解正则 ## 👩🏫图解正则
<details> <details>
<summary>查看详情</summary> <summary>查看详情</summary>
每次在any-rule中选择正则后会弹出提示, 可点击"🤖图解正则". 每次在any-rule中选择正则后会弹出提示, 可点击"🤖图解正则".
![预览图](https://user-gold-cdn.xitu.io/2020/2/23/1706e32c3a6fb116?w=533&h=95&f=png&s=21563) ![image](https://user-images.githubusercontent.com/8264787/146726200-d97e48c3-df76-4531-8210-b6935fffb997.png)
点击后可以看到正则解析, 方便大家学习. 点击后可以看到正则解析, 方便大家学习.
![预览图](https://user-gold-cdn.xitu.io/2020/2/23/1706e349b600c28b?w=1151&h=500&f=png&s=45210) ![image](https://user-images.githubusercontent.com/8264787/146726350-58166bf9-7f7f-4685-86aa-f055d0c0b914.png)
**注意**: 图解直接使用了https://regexper.com, 在此对作者表示敬意和感谢. **注意**: 图解直接使用了https://regexper.com, 在此对作者表示敬意和感谢.
</details> </details>
## 社区版本 ## 社区版本
社区版本非本人维护, 只是其他开发者使用了any-rule整理的正则内容, 如使用出现问题可直接与其开发者联系.
[idea版](https://github.com/zhoriya/idea-rule) [idea版](https://github.com/zhoriya/idea-rule)
[Alfred Workflow版](https://github.com/cccyb/workflows) [Alfred Workflow版](https://github.com/cccyb/workflows)
[hyjs: 函数封装版](https://github.com/heiyehk/hyjs/tree/main/packages/utils)
[命令行版本](https://github.com/shenguanjiejie/workwork)
[uTools版本](https://github.com/trentlee0/utools-any-rule)
## :fire:关于PR ## :fire:关于PR
欢迎大家PR, 步骤如下: 欢迎大家PR, 步骤如下:
1. **正则**请在**packages/www/src/RULES.js**中添加. 1. **正则**请在**packages/www/src/RULES.js**中添加.
@ -83,25 +91,6 @@ vscode应用商店中搜索"**any-rule**".
在此感谢大家对**any-rule**做出的贡献! 在此感谢大家对**any-rule**做出的贡献!
## 👽主要开发者
按照加入时间排序
<table>
<tr>
<td>
<a href="https://github.com/MrTenger"><img width="60" src="https://avatars3.githubusercontent.com/u/10781715?s=60&v=4"></a>
</td>
<td>
<a href="https://github.com/giraffeComing"><img width="60" src="https://avatars2.githubusercontent.com/u/14800669?s=460&v=4"></a>
</td>
<td>
<a href="https://github.com/microud"><img width="60" src="https://avatars1.githubusercontent.com/u/10163257?s=60&v=4"></a>
</td>
<td>
<a href="https://github.com/52cik"><img width="60" src="https://avatars0.githubusercontent.com/u/5033310?s=60&v=4"></a>
</td>
</tr>
</table>
## 🍔正则 ## 🍔正则
`; `;

View File

@ -87,16 +87,16 @@ function insertRule(document: TextDocument, position: Position, ruleString: stri
// 获取配置 // 获取配置
function getConfig() { function getConfig() {
const configuration = workspace.getConfiguration(); const configuration = workspace.getConfiguration();
const { triggerString } = configuration['any-rule']; const { triggerString, supportedLanguages } = configuration['any-rule'];
const { length } = triggerString; const { length } = triggerString;
const triggerStringStart = triggerString.substr(0, length - 1); const triggerStringStart = triggerString.substr(0, length - 1);
const triggerStringEnd = triggerString.substr(-1); const triggerStringEnd = triggerString.substr(-1);
console.log(supportedLanguages);
return { return {
triggerStringStart, triggerStringStart,
triggerStringEnd, triggerStringEnd,
triggerString, triggerString,
// 预留 // 预留
supportedLanguages: '*' supportedLanguages
} }
} }

View File

@ -2070,9 +2070,9 @@ locate-path@^5.0.0:
p-locate "^4.1.0" p-locate "^4.1.0"
lodash@^4.15.0, lodash@^4.17.15: lodash@^4.15.0, lodash@^4.17.15:
version "4.17.15" version "4.17.19"
resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==
log-symbols@2.2.0: log-symbols@2.2.0:
version "2.2.0" version "2.2.0"