docs: 更新文档

This commit is contained in:
Russell 2022-04-18 11:12:26 +08:00
parent 39085bbd42
commit 508b202424
2 changed files with 85 additions and 50 deletions

View File

@ -1,4 +1,4 @@
# 正则大全 ![已收录79条](https://img.shields.io/badge/已收录-79条-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) # 正则大全 ![已收录82条](https://img.shields.io/badge/已收录-82条-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**多平台
@ -114,17 +114,17 @@ vscode应用商店中搜索"**any-rule**".
### linux"隐藏文件"路径 ### linux"隐藏文件"路径
```javascript ```javascript
/^\/(?:[^\/]+\/)*\.[^\/]*/ /^\/(?:[^/]+\/)*\.[^/]*/
``` ```
### linux文件夹路径 ### linux文件夹路径
```javascript ```javascript
/^\/(?:[^\/]+\/)*$/ /^\/(?:[^/]+\/)*$/
``` ```
### linux文件路径 ### linux文件路径
```javascript ```javascript
/^\/(?:[^\/]+\/)*[^\/]+$/ /^\/(?:[^/]+\/)*[^/]+$/
``` ```
### window"文件夹"路径 ### window"文件夹"路径
@ -189,7 +189,7 @@ vscode应用商店中搜索"**any-rule**".
### base64格式 ### base64格式
```javascript ```javascript
/^\s*data:(?:[a-z]+\/[a-z0-9-+.]+(?:;[a-z-]+=[a-z0-9-]+)?)?(?:;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*?)\s*$/i /^\s*data:(?:[a-z]+\/[a-z0-9-+.]+(?:;[a-z-]+=[a-z0-9-]+)?)?(?:;base64)?,([a-z0-9!$&',()*+;=\-._~:@/?%\s]*?)\s*$/i
``` ```
### 数字/货币金额(支持负数、千分位分隔符) ### 数字/货币金额(支持负数、千分位分隔符)
@ -247,14 +247,24 @@ vscode应用商店中搜索"**any-rule**".
/^(?:(?:\+|00)86)?1\d{10}$/ /^(?:(?:\+|00)86)?1\d{10}$/
``` ```
### date(日期) ### 日期(宽松)
```javascript ```javascript
/^\d{1,4}(-)(1[0-2]|0?[1-9])\1(0?[1-9]|[1-2]\d|30|31)$/ /^\d{1,4}(-)(1[0-2]|0?[1-9])\1(0?[1-9]|[1-2]\d|30|31)$/
``` ```
### 日期(严谨, 支持闰年判断)
```javascript
/^(([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)$/
```
### 中国省
```javascript
/^浙江|上海|北京|天津|重庆|黑龙江|吉林|辽宁|内蒙古|河北|新疆|甘肃|青海|陕西|宁夏|河南|山东|山西|安徽|湖北|湖南|江苏|四川|贵州|云南|广西|西藏|江西|广东|福建|台湾|海南|香港|澳门$/
```
### 可以被moment转化成功的时间 YYYYMMDD HH:mm:ss ### 可以被moment转化成功的时间 YYYYMMDD HH:mm:ss
```javascript ```javascript
/^\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$/ /^\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$/
``` ```
### email(邮箱) ### email(邮箱)
@ -302,9 +312,9 @@ vscode应用商店中搜索"**any-rule**".
/^\d+\.\d+$/ /^\d+\.\d+$/
``` ```
### 数字 ### 只包含数字
```javascript ```javascript
/^\d{1,}$/ /^\d+$/
``` ```
### html标签(宽松匹配) ### html标签(宽松匹配)
@ -312,6 +322,11 @@ vscode应用商店中搜索"**any-rule**".
/<(\w+)[^>]*>(.*?<\/\1>)?/ /<(\w+)[^>]*>(.*?<\/\1>)?/
``` ```
### 匹配中文汉字和中文标点
```javascript
/[\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]/
```
### qq号格式正确 ### qq号格式正确
```javascript ```javascript
/^[1-9][0-9]{4,10}$/ /^[1-9][0-9]{4,10}$/

View File

@ -223,167 +223,187 @@
}, },
{ {
"command": "extension.rule37", "command": "extension.rule37",
"title": "$(rocket) zz: date(日期)" "title": "$(rocket) zz: 日期(宽松)"
}, },
{ {
"command": "extension.rule38", "command": "extension.rule38",
"title": "$(rocket) zz: 可以被moment转化成功的时间 YYYYMMDD HH:mm:ss" "title": "$(rocket) zz: 日期(严谨, 支持闰年判断)"
}, },
{ {
"command": "extension.rule39", "command": "extension.rule39",
"title": "$(rocket) zz: email(邮箱)" "title": "$(rocket) zz: 中国省"
}, },
{ {
"command": "extension.rule40", "command": "extension.rule40",
"title": "$(rocket) zz: 座机(tel phone)电话(国内),如: 0341-86091234" "title": "$(rocket) zz: 可以被moment转化成功的时间 YYYYMMDD HH:mm:ss"
}, },
{ {
"command": "extension.rule41", "command": "extension.rule41",
"title": "$(rocket) zz: 身份证号(1代,15位数字)" "title": "$(rocket) zz: email(邮箱)"
}, },
{ {
"command": "extension.rule42", "command": "extension.rule42",
"title": "$(rocket) zz: 身份证号(2代,18位数字),最后一位是校验位,可能为数字或字符X" "title": "$(rocket) zz: 座机(tel phone)电话(国内),如: 0341-86091234"
}, },
{ {
"command": "extension.rule43", "command": "extension.rule43",
"title": "$(rocket) zz: 身份证号, 支持1/2代(15位/18位数字)" "title": "$(rocket) zz: 身份证号(1代,15位数字)"
}, },
{ {
"command": "extension.rule44", "command": "extension.rule44",
"title": "$(rocket) zz: 护照(包含香港、澳门)" "title": "$(rocket) zz: 身份证号(2代,18位数字),最后一位是校验位,可能为数字或字符X"
}, },
{ {
"command": "extension.rule45", "command": "extension.rule45",
"title": "$(rocket) zz: 帐号是否合法(字母开头允许5-16字节允许字母数字下划线组合" "title": "$(rocket) zz: 身份证号, 支持1/2代(15位/18位数字)"
}, },
{ {
"command": "extension.rule46", "command": "extension.rule46",
"title": "$(rocket) zz: 中文/汉字" "title": "$(rocket) zz: 护照(包含香港、澳门)"
}, },
{ {
"command": "extension.rule47", "command": "extension.rule47",
"title": "$(rocket) zz: 小数" "title": "$(rocket) zz: 帐号是否合法(字母开头允许5-16字节允许字母数字下划线组合"
}, },
{ {
"command": "extension.rule48", "command": "extension.rule48",
"title": "$(rocket) zz: 字" "title": "$(rocket) zz: 中文/汉字"
}, },
{ {
"command": "extension.rule49", "command": "extension.rule49",
"title": "$(rocket) zz: html标签(宽松匹配)" "title": "$(rocket) zz: 小数"
}, },
{ {
"command": "extension.rule50", "command": "extension.rule50",
"title": "$(rocket) zz: qq号格式正确" "title": "$(rocket) zz: 只包含数字"
}, },
{ {
"command": "extension.rule51", "command": "extension.rule51",
"title": "$(rocket) zz: 数字和字母组成" "title": "$(rocket) zz: html标签(宽松匹配)"
}, },
{ {
"command": "extension.rule52", "command": "extension.rule52",
"title": "$(rocket) zz: 英文字母" "title": "$(rocket) zz: 匹配中文汉字和中文标点"
}, },
{ {
"command": "extension.rule53", "command": "extension.rule53",
"title": "$(rocket) zz: 小写英文字母组成" "title": "$(rocket) zz: qq号格式正确"
}, },
{ {
"command": "extension.rule54", "command": "extension.rule54",
"title": "$(rocket) zz: 大写英文字母" "title": "$(rocket) zz: 数字和字母组成"
}, },
{ {
"command": "extension.rule55", "command": "extension.rule55",
"title": "$(rocket) zz: 密码强度校验最少6位包括至少1个大写字母1个小写字母1个数字1个特殊字符" "title": "$(rocket) zz: 英文字母"
}, },
{ {
"command": "extension.rule56", "command": "extension.rule56",
"title": "$(rocket) zz: 用户名校验4到16位字母数字下划线减号" "title": "$(rocket) zz: 小写英文字母组成"
}, },
{ {
"command": "extension.rule57", "command": "extension.rule57",
"title": "$(rocket) zz: ip-v4[:端口]" "title": "$(rocket) zz: 大写英文字母"
}, },
{ {
"command": "extension.rule58", "command": "extension.rule58",
"title": "$(rocket) zz: ip-v6[:端口]" "title": "$(rocket) zz: 密码强度校验最少6位包括至少1个大写字母1个小写字母1个数字1个特殊字符"
}, },
{ {
"command": "extension.rule59", "command": "extension.rule59",
"title": "$(rocket) zz: 16进制颜色" "title": "$(rocket) zz: 用户名校验4到16位字母数字下划线减号"
}, },
{ {
"command": "extension.rule60", "command": "extension.rule60",
"title": "$(rocket) zz: 微信号(wx)6至20位以字母开头字母数字减号下划线" "title": "$(rocket) zz: ip-v4[:端口]"
}, },
{ {
"command": "extension.rule61", "command": "extension.rule61",
"title": "$(rocket) zz: 邮政编码(中国)" "title": "$(rocket) zz: ip-v6[:端口]"
}, },
{ {
"command": "extension.rule62", "command": "extension.rule62",
"title": "$(rocket) zz: 中文和数字" "title": "$(rocket) zz: 16进制颜色"
}, },
{ {
"command": "extension.rule63", "command": "extension.rule63",
"title": "$(rocket) zz: 不能包含字母" "title": "$(rocket) zz: 微信号(wx)6至20位以字母开头字母数字减号下划线"
}, },
{ {
"command": "extension.rule64", "command": "extension.rule64",
"title": "$(rocket) zz: java包名" "title": "$(rocket) zz: 邮政编码(中国)"
}, },
{ {
"command": "extension.rule65", "command": "extension.rule65",
"title": "$(rocket) zz: mac地址" "title": "$(rocket) zz: 中文和数字"
}, },
{ {
"command": "extension.rule66", "command": "extension.rule66",
"title": "$(rocket) zz: 匹配连续重复的字符" "title": "$(rocket) zz: 不能包含字母"
}, },
{ {
"command": "extension.rule67", "command": "extension.rule67",
"title": "$(rocket) zz: 数字和英文字母组成,并且同时含有数字和英文字母" "title": "$(rocket) zz: java包名"
}, },
{ {
"command": "extension.rule68", "command": "extension.rule68",
"title": "$(rocket) zz: 香港身份证 " "title": "$(rocket) zz: mac地址"
}, },
{ {
"command": "extension.rule69", "command": "extension.rule69",
"title": "$(rocket) zz: 澳门身份证 " "title": "$(rocket) zz: 匹配连续重复的字符"
}, },
{ {
"command": "extension.rule70", "command": "extension.rule70",
"title": "$(rocket) zz: 台湾身份证 " "title": "$(rocket) zz: 数字和英文字母组成,并且同时含有数字和英文字母"
}, },
{ {
"command": "extension.rule71", "command": "extension.rule71",
"title": "$(rocket) zz: 大写字母,小写字母,数字,特殊符号 `@#$%^&*`~()-+=` 中任意3项密码" "title": "$(rocket) zz: 香港身份证 "
}, },
{ {
"command": "extension.rule72", "command": "extension.rule72",
"title": "$(rocket) zz: 正整数不包含0" "title": "$(rocket) zz: 澳门身份证 "
}, },
{ {
"command": "extension.rule73", "command": "extension.rule73",
"title": "$(rocket) zz: 负整数不包含0" "title": "$(rocket) zz: 台湾身份证 "
}, },
{ {
"command": "extension.rule74", "command": "extension.rule74",
"title": "$(rocket) zz: 整数" "title": "$(rocket) zz: 大写字母,小写字母,数字,特殊符号 `@#$%^&*`~()-+=` 中任意3项密码"
}, },
{ {
"command": "extension.rule75", "command": "extension.rule75",
"title": "$(rocket) zz: 浮点数" "title": "$(rocket) zz: ASCII码表中的全部的特殊字符"
}, },
{ {
"command": "extension.rule76", "command": "extension.rule76",
"title": "$(rocket) zz: 正整数不包含0"
},
{
"command": "extension.rule77",
"title": "$(rocket) zz: 负整数不包含0"
},
{
"command": "extension.rule78",
"title": "$(rocket) zz: 整数"
},
{
"command": "extension.rule79",
"title": "$(rocket) zz: 浮点数"
},
{
"command": "extension.rule80",
"title": "$(rocket) zz: 浮点数(严格)"
},
{
"command": "extension.rule81",
"title": "$(rocket) zz: email(支持中文邮箱)" "title": "$(rocket) zz: email(支持中文邮箱)"
}, },
{ {
"command": "extension.rule.callByMenu", "command": "extension.rule.callByMenu",
"title": "🦕正则大全(77条)" "title": "🦕正则大全(82条)"
} }
] ]
}, },