mirror of
https://github.com/any86/any-rule.git
synced 2025-07-14 15:38:58 +08:00
Merge branch 'develop'
This commit is contained in:
commit
36236a6d04
9
.gitignore
vendored
9
.gitignore
vendored
@ -1,5 +1,12 @@
|
||||
out
|
||||
node_modules
|
||||
coverage
|
||||
.nyc_output
|
||||
.vscode-test/
|
||||
.idea
|
||||
.vscode
|
||||
.DS_Store
|
||||
*.vsix
|
||||
yarn-error.log
|
||||
yarn-error.log
|
||||
.rpt2_cache
|
||||
dist
|
||||
|
151
README.md
151
README.md
@ -1,65 +1,65 @@
|
||||
# 正则大全  [](https://marketplace.visualstudio.com/items?itemName=russell.any-rule) [](https://marketplace.visualstudio.com/items?itemName=russell.any-rule) [](https://marketplace.visualstudio.com/items?itemName=russell.any-rule)  [](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. **输入关键词搜索**, 比如"手机".
|
||||
|
||||

|
||||
|
||||
**方式2:**
|
||||
|
||||
右键选择"🦕正则大全".
|
||||
|
||||

|
||||
|
||||
**方式3:**
|
||||
|
||||
在代码任意位置输入"**@zz**".
|
||||
|
||||
|
||||

|
||||
|
||||
## 👩🏫图解正则
|
||||
<details>
|
||||
<summary>查看详情</summary>
|
||||
每次在any-rule中选择正则后会弹出提示, 可点击"🤖图解正则".
|
||||
|
||||

|
||||
|
||||
点击后可以看到正则解析, 方便大家学习.
|
||||
|
||||

|
||||
|
||||
**注意**: 图解直接使用了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**做出的贡献!
|
||||
|
||||
## 🍔正则
|
||||
# 正则大全  [](https://marketplace.visualstudio.com/items?itemName=russell.any-rule) [](https://marketplace.visualstudio.com/items?itemName=russell.any-rule) [](https://marketplace.visualstudio.com/items?itemName=russell.any-rule)  [](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. **输入关键词搜索**, 比如"手机".
|
||||
|
||||

|
||||
|
||||
**方式2:**
|
||||
|
||||
右键选择"🦕正则大全".
|
||||
|
||||

|
||||
|
||||
**方式3:**
|
||||
|
||||
在代码任意位置输入"**@zz**".
|
||||
|
||||
|
||||

|
||||
|
||||
## 👩🏫图解正则
|
||||
<details>
|
||||
<summary>查看详情</summary>
|
||||
每次在any-rule中选择正则后会弹出提示, 可点击"🤖图解正则".
|
||||
|
||||

|
||||
|
||||
点击后可以看到正则解析, 方便大家学习.
|
||||
|
||||

|
||||
|
||||
**注意**: 图解直接使用了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
|
||||
@ -148,7 +148,7 @@ vscode应用商店中搜索"**any-rule**".
|
||||
|
||||
### html注释
|
||||
```javascript
|
||||
/^<!--[\s\S]*?-->$/
|
||||
/<!--[\s\S]*?-->/g
|
||||
```
|
||||
|
||||
### md5格式(32位)
|
||||
@ -410,3 +410,28 @@ vscode应用商店中搜索"**any-rule**".
|
||||
```javascript
|
||||
/^[a-zA-Z][0-9]{9}$/
|
||||
```
|
||||
|
||||
### 正整数,不包含0
|
||||
```javascript
|
||||
/^\+?[1-9]\d*$/
|
||||
```
|
||||
|
||||
### 负整数,不包含0
|
||||
```javascript
|
||||
/^-[1-9]\d*$/
|
||||
```
|
||||
|
||||
### 整数
|
||||
```javascript
|
||||
/^-?[0-9]\d*$/
|
||||
```
|
||||
|
||||
### 浮点数
|
||||
```javascript
|
||||
/^(-?\d+)(\.\d+)?$/
|
||||
```
|
||||
|
||||
### email(支持中文邮箱)
|
||||
```javascript
|
||||
/^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
|
||||
```
|
||||
|
20
package.json
20
package.json
@ -346,6 +346,26 @@
|
||||
"command": "extension.rule69",
|
||||
"title": "$(rocket) zz: 台湾身份证 "
|
||||
},
|
||||
{
|
||||
"command": "extension.rule70",
|
||||
"title": "$(rocket) zz: 正整数,不包含0 "
|
||||
},
|
||||
{
|
||||
"command": "extension.rule71",
|
||||
"title": "$(rocket) zz: 负整数,不包含0 "
|
||||
},
|
||||
{
|
||||
"command": "extension.rule72",
|
||||
"title": "$(rocket) zz: 整数 "
|
||||
},
|
||||
{
|
||||
"command": "extension.rule73",
|
||||
"title": "$(rocket) zz: 浮点数 "
|
||||
},
|
||||
{
|
||||
"command": "extension.rule74",
|
||||
"title": "$(rocket) zz: email(支持中文邮箱) "
|
||||
},
|
||||
{
|
||||
"command": "extension.rule.callByMenu",
|
||||
"title": "🦕正则大全(70条)"
|
||||
|
@ -16,8 +16,8 @@ module.exports = [{
|
||||
},
|
||||
{
|
||||
title: '网址(url,支持端口和"?+参数"和"#+参数)',
|
||||
rule: /^(((ht|f)tps?):\/\/)?[\w-]+(\.[\w-]+)+([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?$/,
|
||||
examples: ['www.qq.com', 'https://baidu.com', '360.com:8080/vue/#/a=1&b=2'],
|
||||
rule: /^(((ht|f)tps?):\/\/)?[\w-]+(\.[\w-]+)+([\w.,@?^=%&:/~+#-\(\)]*[\w@?^=%&/~+#-\(\)])?$/,
|
||||
examples: ['www.qq.com', 'https://baidu.com', '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'],
|
||||
counterExamples: ['....']
|
||||
},
|
||||
{
|
||||
@ -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位)',
|
||||
@ -115,7 +115,7 @@ module.exports = [{
|
||||
{
|
||||
title: '图片(image)链接地址(图片格式可按需增删)',
|
||||
rule: /^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i,
|
||||
examples: ['https://www.abc.com/logo.png']
|
||||
examples: ['https://www.abc.com/logo.png', 'http://www.abc.com/logo.png']
|
||||
},
|
||||
{
|
||||
title: '24小时制时间(HH:mm:ss)',
|
||||
@ -192,7 +192,7 @@ module.exports = [{
|
||||
{
|
||||
title: 'date(日期)',
|
||||
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'],
|
||||
examples: ['1990-12-12', '1-1-1', '0000-1-1'],
|
||||
counterExamples: ['2020-00-01']
|
||||
},
|
||||
{
|
||||
@ -358,4 +358,29 @@ module.exports = [{
|
||||
rule: /^[a-zA-Z][0-9]{9}$/,
|
||||
examples: ['U193683453']
|
||||
},
|
||||
{
|
||||
title: '正整数,不包含0',
|
||||
rule: /^\+?[1-9]\d*$/,
|
||||
examples: [1231]
|
||||
},
|
||||
{
|
||||
title: '负整数,不包含0',
|
||||
rule: /^-[1-9]\d*$/,
|
||||
examples: [-1231]
|
||||
},
|
||||
{
|
||||
title: '整数',
|
||||
rule: /^-?[0-9]\d*$/,
|
||||
examples: [-1231, 123]
|
||||
},
|
||||
{
|
||||
title: '浮点数',
|
||||
rule: /^(-?\d+)(\.\d+)?$/,
|
||||
examples: [1.5]
|
||||
},
|
||||
{
|
||||
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']
|
||||
}
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user