Merge pull request #184 from chenguzhen87/master

html注释正则修改
This commit is contained in:
any86 2021-07-23 15:27:14 +08:00 committed by GitHub
commit 9c322ba759
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 139 additions and 165 deletions

2
.gitattributes vendored
View File

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

View File

@ -1,6 +1,13 @@
# 更新日志
🚀 [提交问题](https://github.com/any86/any-rule/issues/new)
### 0.3.10(2021-05-28)
- 禁止"日期"可以通过"00"月和"00"日
### 0.3.9(2021-04-20)
- 新增"GUID/UUID"正则.
- 修复ip中的"."没有被转义.
### 0.3.8(2021-01-17)
- 优化一些冗余的正则拼写
- 修复新能源汽车不匹配第三位为字母的情况.

149
README.md
View File

@ -1,84 +1,65 @@
# 正则大全 ![已收录70条](https://img.shields.io/badge/已收录-70条-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**多平台
## :rocket:web版本
https://any86.github.io/any-rule/
## 🍭vscode插件
### 安装
vscode应用商店中搜索"**any-rule**".
### 使用
**方式1:**
1. 按**F1**(mac下fn+F1)打开正则列表.
2. **输入关键词搜索**, 比如"手机".
![预览图](https://user-gold-cdn.xitu.io/2020/1/10/16f8e01a684a0a18?w=420&h=243&f=gif&s=414162)
**方式2:**
右键选择"🦕正则大全".
![](https://user-gold-cdn.xitu.io/2020/2/28/17087735718cca3b?w=389&h=400&f=png&s=55934)
**方式3:**
在代码任意位置输入"**@zz**".
![预览图](https://user-gold-cdn.xitu.io/2020/2/28/17089999afc7a21c?w=722&h=408&f=gif&s=299355)
## 👩‍🏫图解正则
<details>
<summary>查看详情</summary>
每次在any-rule中选择正则后会弹出提示, 可点击"🤖图解正则".
![预览图](https://user-gold-cdn.xitu.io/2020/2/23/1706e32c3a6fb116?w=533&h=95&f=png&s=21563)
点击后可以看到正则解析, 方便大家学习.
![预览图](https://user-gold-cdn.xitu.io/2020/2/23/1706e349b600c28b?w=1151&h=500&f=png&s=45210)
**注意**: 图解直接使用了https://regexper.com, 在此对作者表示敬意和感谢.
</details>
## 社区版本
[idea版](https://github.com/zhoriya/idea-rule)
[Alfred Workflow版](https://github.com/cccyb/workflows)
## :fire:关于PR
欢迎大家PR, 步骤如下:
1. **正则**请在**packages/www/src/RULES.js**中添加.
2. 运行`npm run test:rules`进行测试.
3. 运行`npm run build:md`更新**README.md**.
4. 请务必提交到**develop**分支.
在此感谢大家对**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>
## 🍔正则
# 正则大全 ![已收录70条](https://img.shields.io/badge/已收录-70条-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**多平台
## :rocket:web版本
https://any86.github.io/any-rule/
## 🍭vscode插件
### 安装
vscode应用商店中搜索"**any-rule**".
### 使用
**方式1:**
1. 按**F1**(mac下fn+F1)打开正则列表.
2. **输入关键词搜索**, 比如"手机".
![预览图](https://user-gold-cdn.xitu.io/2020/1/10/16f8e01a684a0a18?w=420&h=243&f=gif&s=414162)
**方式2:**
右键选择"🦕正则大全".
![](https://user-gold-cdn.xitu.io/2020/2/28/17087735718cca3b?w=389&h=400&f=png&s=55934)
**方式3:**
在代码任意位置输入"**@zz**".
![预览图](https://user-gold-cdn.xitu.io/2020/2/28/17089999afc7a21c?w=722&h=408&f=gif&s=299355)
## 👩‍🏫图解正则
<details>
<summary>查看详情</summary>
每次在any-rule中选择正则后会弹出提示, 可点击"🤖图解正则".
![预览图](https://user-gold-cdn.xitu.io/2020/2/23/1706e32c3a6fb116?w=533&h=95&f=png&s=21563)
点击后可以看到正则解析, 方便大家学习.
![预览图](https://user-gold-cdn.xitu.io/2020/2/23/1706e349b600c28b?w=1151&h=500&f=png&s=45210)
**注意**: 图解直接使用了https://regexper.com, 在此对作者表示敬意和感谢.
</details>
## 社区版本
[idea版](https://github.com/zhoriya/idea-rule)
[Alfred Workflow版](https://github.com/cccyb/workflows)
## :fire:关于PR
欢迎大家PR, 步骤如下:
1. **正则**请在**packages/www/src/RULES.js**中添加.
2. 运行`npm run test:rules`进行测试.
3. 运行`npm run build:md`更新**README.md**.
4. 请务必提交到**develop**分支.
在此感谢大家对**any-rule**做出的贡献!
## 🍔正则
### 火车车次
```javascript
@ -167,7 +148,7 @@ vscode应用商店中搜索"**any-rule**".
### html注释
```javascript
/^<!--[\s\S]*?-->$/
/<!--[\s\S]*?-->/g
```
### md5格式(32位)
@ -175,7 +156,7 @@ vscode应用商店中搜索"**any-rule**".
/^([a-f\d]{32}|[A-F\d]{32})$/
```
### GUID(Globally Unique Identifier 全球唯一标识符) / UUID(Universally Unique IDentifier)
### GUID/UUID
```javascript
/^[a-f\d]{4}(?:[a-f\d]{4}-){4}[a-f\d]{12}$/i
```
@ -267,7 +248,7 @@ vscode应用商店中搜索"**any-rule**".
### date(日期)
```javascript
/^\d{4}(-)(1[0-2]|0?\d)\1([0-2]\d|\d|30|31)$/
/^\d{1,4}(-)(1[0-2]|0?[1-9])\1(0?[1-9]|[1-2]\d|30|31)$/
```
### email(邮箱)

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "any-rule",
"version": "0.3.8",
"version": "0.3.10",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -3,7 +3,7 @@
"publisher": "russell",
"displayName": "any-rule",
"description": "你要的\"正则\"都在这!",
"version": "0.3.8",
"version": "0.3.10",
"husky": {
"hooks": {
"pre-push": "npm run test:rules"
@ -139,207 +139,211 @@
},
{
"command": "extension.rule19",
"title": "$(rocket) zz: 版本号(version)格式必须为X.Y.Z"
"title": "$(rocket) zz: GUID/UUID"
},
{
"command": "extension.rule20",
"title": "$(rocket) zz: 视频(video)链接地址(视频格式可按需增删)"
"title": "$(rocket) zz: 版本号(version)格式必须为X.Y.Z"
},
{
"command": "extension.rule21",
"title": "$(rocket) zz: 图片(image)链接地址(图片格式可按需增删)"
"title": "$(rocket) zz: 视频(video)链接地址(视频格式可按需增删)"
},
{
"command": "extension.rule22",
"title": "$(rocket) zz: 24小时制时间HH:mm:ss"
"title": "$(rocket) zz: 图片(image)链接地址(图片格式可按需增删"
},
{
"command": "extension.rule23",
"title": "$(rocket) zz: 12小时制时间hh:mm:ss"
"title": "$(rocket) zz: 24小时制时间HH:mm:ss"
},
{
"command": "extension.rule24",
"title": "$(rocket) zz: base64格式"
"title": "$(rocket) zz: 12小时制时间hh:mm:ss"
},
{
"command": "extension.rule25",
"title": "$(rocket) zz: 数字/货币金额(支持负数、千分位分隔符)"
"title": "$(rocket) zz: base64格式"
},
{
"command": "extension.rule26",
"title": "$(rocket) zz: 数字/货币金额 (只支持正数、不支持校验千分位分隔符)"
"title": "$(rocket) zz: 数字/货币金额(支持负数、千分位分隔符)"
},
{
"command": "extension.rule27",
"title": "$(rocket) zz: 银行卡号10到30位, 覆盖对公/私账户, 参考[微信支付](https://pay.weixin.qq.com/wiki/doc/api/xiaowei.php?chapter=22_1)"
"title": "$(rocket) zz: 数字/货币金额 (只支持正数、不支持校验千分位分隔符)"
},
{
"command": "extension.rule28",
"title": "$(rocket) zz: 中文姓名"
"title": "$(rocket) zz: 银行卡号10到30位, 覆盖对公/私账户, 参考[微信支付](https://pay.weixin.qq.com/wiki/doc/api/xiaowei.php?chapter=22_1)"
},
{
"command": "extension.rule29",
"title": "$(rocket) zz: 文姓名"
"title": "$(rocket) zz: 文姓名"
},
{
"command": "extension.rule30",
"title": "$(rocket) zz: 车牌号(新能源)"
"title": "$(rocket) zz: 英文姓名"
},
{
"command": "extension.rule31",
"title": "$(rocket) zz: 车牌号(新能源)"
"title": "$(rocket) zz: 车牌号(新能源)"
},
{
"command": "extension.rule32",
"title": "$(rocket) zz: 车牌号(新能源+非新能源)"
"title": "$(rocket) zz: 车牌号(非新能源)"
},
{
"command": "extension.rule33",
"title": "$(rocket) zz: 手机号(mobile phone)中国(严谨), 根据工信部2019年最新公布的手机号段"
"title": "$(rocket) zz: 车牌号(新能源+非新能源)"
},
{
"command": "extension.rule34",
"title": "$(rocket) zz: 手机号(mobile phone)中国(宽松), 只要是13,14,15,16,17,18,19开头即可"
"title": "$(rocket) zz: 手机号(mobile phone)中国(严谨), 根据工信部2019年最新公布的手机号段"
},
{
"command": "extension.rule35",
"title": "$(rocket) zz: 手机号(mobile phone)中国(宽松), 只要是1开头即可, 如果你的手机号是用来接收短信, 优先建议选择这一条"
"title": "$(rocket) zz: 手机号(mobile phone)中国(宽松), 只要是13,14,15,16,17,18,19开头即可"
},
{
"command": "extension.rule36",
"title": "$(rocket) zz: date(日期)"
"title": "$(rocket) zz: 手机号(mobile phone)中国(最宽松), 只要是1开头即可, 如果你的手机号是用来接收短信, 优先建议选择这一条"
},
{
"command": "extension.rule37",
"title": "$(rocket) zz: email(邮箱)"
"title": "$(rocket) zz: date(日期)"
},
{
"command": "extension.rule38",
"title": "$(rocket) zz: 座机(tel phone)电话(国内),如: 0341-86091234"
"title": "$(rocket) zz: email(邮箱)"
},
{
"command": "extension.rule39",
"title": "$(rocket) zz: 身份证号(1代,15位数字)"
"title": "$(rocket) zz: 座机(tel phone)电话(国内),如: 0341-86091234"
},
{
"command": "extension.rule40",
"title": "$(rocket) zz: 身份证号(2代,18位数字),最后一位是校验位,可能为数字或字符X"
"title": "$(rocket) zz: 身份证号(1代,15位数字)"
},
{
"command": "extension.rule41",
"title": "$(rocket) zz: 身份证号, 支持1/2代(15位/18位数字)"
"title": "$(rocket) zz: 身份证号(2代,18位数字),最后一位是校验位,可能为数字或字符X"
},
{
"command": "extension.rule42",
"title": "$(rocket) zz: 护照(包含香港、澳门)"
"title": "$(rocket) zz: 身份证号, 支持1/2代(15位/18位数字)"
},
{
"command": "extension.rule43",
"title": "$(rocket) zz: 帐号是否合法(字母开头允许5-16字节允许字母数字下划线组合"
"title": "$(rocket) zz: 护照(包含香港、澳门)"
},
{
"command": "extension.rule44",
"title": "$(rocket) zz: 中文/汉字"
"title": "$(rocket) zz: 帐号是否合法(字母开头允许5-16字节允许字母数字下划线组合"
},
{
"command": "extension.rule45",
"title": "$(rocket) zz: 小数"
"title": "$(rocket) zz: 中文/汉字"
},
{
"command": "extension.rule46",
"title": "$(rocket) zz: "
"title": "$(rocket) zz: 数"
},
{
"command": "extension.rule47",
"title": "$(rocket) zz: html标签(宽松匹配)"
"title": "$(rocket) zz: 数字"
},
{
"command": "extension.rule48",
"title": "$(rocket) zz: qq号格式正确"
"title": "$(rocket) zz: html标签(宽松匹配)"
},
{
"command": "extension.rule49",
"title": "$(rocket) zz: 数字和字母组成"
"title": "$(rocket) zz: qq号格式正确"
},
{
"command": "extension.rule50",
"title": "$(rocket) zz: 英文字母"
"title": "$(rocket) zz: 数字和字母组成"
},
{
"command": "extension.rule51",
"title": "$(rocket) zz: 小写英文字母组成"
"title": "$(rocket) zz: 英文字母"
},
{
"command": "extension.rule52",
"title": "$(rocket) zz: 大写英文字母"
"title": "$(rocket) zz: 小写英文字母组成"
},
{
"command": "extension.rule53",
"title": "$(rocket) zz: 密码强度校验最少6位包括至少1个大写字母1个小写字母1个数字1个特殊字符"
"title": "$(rocket) zz: 大写英文字母"
},
{
"command": "extension.rule54",
"title": "$(rocket) zz: 用户名校验4到16位字母数字下划线减号"
"title": "$(rocket) zz: 密码强度校验最少6位包括至少1个大写字母1个小写字母1个数字1个特殊字符"
},
{
"command": "extension.rule55",
"title": "$(rocket) zz: ip-v4[:端口]"
"title": "$(rocket) zz: 用户名校验4到16位字母数字下划线减号"
},
{
"command": "extension.rule56",
"title": "$(rocket) zz: ip-v6[:端口]"
"title": "$(rocket) zz: ip-v4[:端口]"
},
{
"command": "extension.rule57",
"title": "$(rocket) zz: 16进制颜色"
"title": "$(rocket) zz: ip-v6[:端口]"
},
{
"command": "extension.rule58",
"title": "$(rocket) zz: 微信号(wx)6至20位以字母开头字母数字减号下划线"
"title": "$(rocket) zz: 16进制颜色"
},
{
"command": "extension.rule59",
"title": "$(rocket) zz: 邮政编码(中国)"
"title": "$(rocket) zz: 微信号(wx)6至20位以字母开头字母数字减号下划线"
},
{
"command": "extension.rule60",
"title": "$(rocket) zz: 中文和数字"
"title": "$(rocket) zz: 邮政编码(中国)"
},
{
"command": "extension.rule61",
"title": "$(rocket) zz: 不能包含字母"
"title": "$(rocket) zz: 中文和数字"
},
{
"command": "extension.rule62",
"title": "$(rocket) zz: java包名"
"title": "$(rocket) zz: 不能包含字母"
},
{
"command": "extension.rule63",
"title": "$(rocket) zz: mac地址"
"title": "$(rocket) zz: java包名"
},
{
"command": "extension.rule64",
"title": "$(rocket) zz: 匹配连续重复的字符"
"title": "$(rocket) zz: mac地址"
},
{
"command": "extension.rule65",
"title": "$(rocket) zz: 数字和英文字母组成,并且同时含有数字和英文字母"
"title": "$(rocket) zz: 匹配连续重复的字符"
},
{
"command": "extension.rule66",
"title": "$(rocket) zz: 香港身份证 "
"title": "$(rocket) zz: 数字和英文字母组成,并且同时含有数字和英文字母"
},
{
"command": "extension.rule67",
"title": "$(rocket) zz: 澳门身份证 "
"title": "$(rocket) zz: 香港身份证 "
},
{
"command": "extension.rule68",
"title": "$(rocket) zz: 澳门身份证 "
},
{
"command": "extension.rule69",
"title": "$(rocket) zz: 台湾身份证 "
},
{
"command": "extension.rule.callByMenu",
"title": "🦕正则大全(69条)"
"title": "🦕正则大全(70条)"
}
]
},
@ -364,4 +368,4 @@
"axios": "^0.19.2",
"transliteration": "^2.1.8"
}
}
}

View File

@ -89,8 +89,8 @@ module.exports = [{
},
{
title: 'html注释',
rule: /^<!--[\s\S]*?-->$/,
examples: ['<!--<div class="_bubble"></div>-->']
rule: /<!--[\s\S]*?-->/g,
examples: ['<!--<div class="_bubble"></div>--><div>chenguzhen87</div><div class="_bubble"></div>-->']
},
{
title: 'md5格式(32位)',
@ -98,7 +98,7 @@ module.exports = [{
examples: ['21fe181c5bfc16306a6828c1f7b762e8'],
},
{
title: 'GUID(Globally Unique Identifier 全球唯一标识符) / UUID(Universally Unique IDentifier)',
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'],
},
@ -191,8 +191,9 @@ module.exports = [{
},
{
title: 'date(日期)',
rule: /^\d{4}(-)(1[0-2]|0?\d)\1([0-2]\d|\d|30|31)$/,
examples: ['1990-12-12', '2020-1-1']
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: 'email(邮箱)',

View File

@ -5522,10 +5522,10 @@ node-releases@^1.1.58:
resolved "https://registry.npm.taobao.org/node-releases/download/node-releases-1.1.60.tgz?cache=0&sync_timestamp=1595485319901&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnode-releases%2Fdownload%2Fnode-releases-1.1.60.tgz#6948bdfce8286f0b5d0e5a88e8384e954dfe7084"
integrity sha1-aUi9/OgobwtdDlqI6DhOlU3+cIQ=
node-sass@^4.12.0:
node-sass@^4.13.1:
version "4.14.1"
resolved "https://registry.npm.taobao.org/node-sass/download/node-sass-4.14.1.tgz?cache=0&sync_timestamp=1589682128498&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnode-sass%2Fdownload%2Fnode-sass-4.14.1.tgz#99c87ec2efb7047ed638fb4c9db7f3a42e2217b5"
integrity sha1-mch+wu+3BH7WOPtMnbfzpC4iF7U=
resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.14.1.tgz#99c87ec2efb7047ed638fb4c9db7f3a42e2217b5"
integrity sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==
dependencies:
async-foreach "^0.1.3"
chalk "^1.1.1"

View File

@ -83,25 +83,6 @@ vscode应用商店中搜索"**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>
## 🍔正则
`;