Merge branch 'master' into develop

This commit is contained in:
Russell 2022-09-01 10:17:39 +08:00
commit 0be115a81f
11 changed files with 549 additions and 27635 deletions

View File

@ -30,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

View File

@ -1,6 +1,10 @@
# 更新日志 # 更新日志
🚀 [提交问题](https://github.com/any86/any-rule/issues/new) 🚀 [提交问题](https://github.com/any86/any-rule/issues/new)
### 0.3.13(2022-01-10)
- 修正"网址"正则, 兼容更多符合的网址.
- 修正澳门身份证错误.
### 0.3.12(2021-10-20) ### 0.3.12(2021-10-20)
- 修复网址中带有"()"不能通过. - 修复网址中带有"()"不能通过.
- 新增"整数"/"浮点数"等正则. - 新增"整数"/"浮点数"等正则.

View File

@ -1,9 +1,9 @@
# 正则大全 ![已收录78条](https://img.shields.io/badge/已收录-78条-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) # 正则大全 ![已收录77条](https://img.shields.io/badge/已收录-77条-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**中添加.
@ -60,6 +68,7 @@ vscode应用商店中搜索"**any-rule**".
在此感谢大家对**any-rule**做出的贡献! 在此感谢大家对**any-rule**做出的贡献!
## 🍔正则 ## 🍔正则
<<<<<<< HEAD
### 火车车次 ### 火车车次
```javascript ```javascript
@ -445,8 +454,3 @@ vscode应用商店中搜索"**any-rule**".
```javascript ```javascript
/^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/ /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
``` ```
### 车架号
```javascript
/^[A-HJ-NPR-Z\d]{17}$/
```

6311
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,13 @@
"publisher": "russell", "publisher": "russell",
"displayName": "any-rule", "displayName": "any-rule",
"description": "你要的\"正则\"都在这!", "description": "你要的\"正则\"都在这!",
"version": "0.3.12", "version": "0.3.15",
"keywords": [
"vscode",
"typescript",
"regxp",
"正则"
],
"husky": { "husky": {
"hooks": { "hooks": {
"pre-push": "npm run test:rules" "pre-push": "npm run test:rules"
@ -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",
@ -80,7 +87,7 @@
}, },
{ {
"command": "extension.rule3", "command": "extension.rule3",
"title": "$(rocket) zz: 网址(url,支持端口和\"?+参数\"和\"#+参数)" "title": "$(rocket) zz: 网址(URL)"
}, },
{ {
"command": "extension.rule4", "command": "extension.rule4",
@ -104,7 +111,7 @@
}, },
{ {
"command": "extension.rule9", "command": "extension.rule9",
"title": "$(rocket) zz: 子网掩码" "title": "$(rocket) zz: 子网掩码(不包含 0.0.0.0)"
}, },
{ {
"command": "extension.rule10", "command": "extension.rule10",
@ -216,67 +223,67 @@
}, },
{ {
"command": "extension.rule37", "command": "extension.rule37",
"title": "$(rocket) zz: date(日期)" "title": "$(rocket) zz: 日期(宽松)"
}, },
{ {
"command": "extension.rule38", "command": "extension.rule38",
"title": "$(rocket) zz: email(邮箱)" "title": "$(rocket) zz: 日期(严谨, 支持闰年判断)"
}, },
{ {
"command": "extension.rule39", "command": "extension.rule39",
"title": "$(rocket) zz: 座机(tel phone)电话(国内),如: 0341-86091234" "title": "$(rocket) zz: 中国省"
}, },
{ {
"command": "extension.rule40", "command": "extension.rule40",
"title": "$(rocket) zz: 身份证号(1代,15位数字)" "title": "$(rocket) zz: 可以被moment转化成功的时间 YYYYMMDD HH:mm:ss"
}, },
{ {
"command": "extension.rule41", "command": "extension.rule41",
"title": "$(rocket) zz: 身份证号(2代,18位数字),最后一位是校验位,可能为数字或字符X" "title": "$(rocket) zz: email(邮箱)"
}, },
{ {
"command": "extension.rule42", "command": "extension.rule42",
"title": "$(rocket) zz: 身份证号, 支持1/2代(15位/18位数字)" "title": "$(rocket) zz: 座机(tel phone)电话(国内),如: 0341-86091234"
}, },
{ {
"command": "extension.rule43", "command": "extension.rule43",
"title": "$(rocket) zz: 护照(包含香港、澳门)" "title": "$(rocket) zz: 身份证号(1代,15位数字)"
}, },
{ {
"command": "extension.rule44", "command": "extension.rule44",
"title": "$(rocket) zz: 帐号是否合法(字母开头允许5-16字节允许字母数字下划线组合" "title": "$(rocket) zz: 身份证号(2代,18位数字),最后一位是校验位,可能为数字或字符X"
}, },
{ {
"command": "extension.rule45", "command": "extension.rule45",
"title": "$(rocket) zz: 中文/汉字" "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: html标签(宽松匹配)" "title": "$(rocket) zz: 中文/汉字"
}, },
{ {
"command": "extension.rule49", "command": "extension.rule49",
"title": "$(rocket) zz: qq号格式正确" "title": "$(rocket) zz: 小数"
}, },
{ {
"command": "extension.rule50", "command": "extension.rule50",
"title": "$(rocket) zz: 数字和字母组成" "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",
@ -287,92 +294,100 @@
"title": "$(rocket) zz: 密码强度校验最少6位包括至少1个大写字母1个小写字母1个数字1个特殊字符" "title": "$(rocket) zz: 密码强度校验最少6位包括至少1个大写字母1个小写字母1个数字1个特殊字符"
}, },
{ {
"command": "extension.rule55", "command": "extension.rule59",
"title": "$(rocket) zz: 用户名校验4到16位字母数字下划线减号" "title": "$(rocket) zz: 用户名校验4到16位字母数字下划线减号"
}, },
{ {
"command": "extension.rule56", "command": "extension.rule60",
"title": "$(rocket) zz: ip-v4[:端口]" "title": "$(rocket) zz: ip-v4[:端口]"
}, },
{ {
"command": "extension.rule57", "command": "extension.rule61",
"title": "$(rocket) zz: ip-v6[:端口]" "title": "$(rocket) zz: ip-v6[:端口]"
}, },
{ {
"command": "extension.rule58", "command": "extension.rule62",
"title": "$(rocket) zz: 16进制颜色" "title": "$(rocket) zz: 16进制颜色"
}, },
{ {
"command": "extension.rule59", "command": "extension.rule63",
"title": "$(rocket) zz: 微信号(wx)6至20位以字母开头字母数字减号下划线" "title": "$(rocket) zz: 微信号(wx)6至20位以字母开头字母数字减号下划线"
}, },
{ {
"command": "extension.rule60", "command": "extension.rule64",
"title": "$(rocket) zz: 邮政编码(中国)" "title": "$(rocket) zz: 邮政编码(中国)"
}, },
{ {
"command": "extension.rule61", "command": "extension.rule65",
"title": "$(rocket) zz: 中文和数字" "title": "$(rocket) zz: 中文和数字"
}, },
{ {
"command": "extension.rule62", "command": "extension.rule66",
"title": "$(rocket) zz: 不能包含字母" "title": "$(rocket) zz: 不能包含字母"
}, },
{ {
"command": "extension.rule63", "command": "extension.rule67",
"title": "$(rocket) zz: java包名" "title": "$(rocket) zz: java包名"
}, },
{ {
"command": "extension.rule64", "command": "extension.rule68",
"title": "$(rocket) zz: mac地址" "title": "$(rocket) zz: mac地址"
}, },
{ {
"command": "extension.rule65", "command": "extension.rule69",
"title": "$(rocket) zz: 匹配连续重复的字符" "title": "$(rocket) zz: 匹配连续重复的字符"
}, },
{ {
"command": "extension.rule66", "command": "extension.rule70",
"title": "$(rocket) zz: 数字和英文字母组成,并且同时含有数字和英文字母" "title": "$(rocket) zz: 数字和英文字母组成,并且同时含有数字和英文字母"
}, },
{ {
"command": "extension.rule67", "command": "extension.rule71",
"title": "$(rocket) zz: 香港身份证 " "title": "$(rocket) zz: 香港身份证 "
}, },
{ {
"command": "extension.rule68", "command": "extension.rule72",
"title": "$(rocket) zz: 澳门身份证 " "title": "$(rocket) zz: 澳门身份证 "
}, },
{ {
"command": "extension.rule69", "command": "extension.rule73",
"title": "$(rocket) zz: 台湾身份证 " "title": "$(rocket) zz: 台湾身份证 "
}, },
{ {
"command": "extension.rule70", "command": "extension.rule74",
"title": "$(rocket) zz: 大写字母,小写字母,数字,特殊符号 `@#$%^&*`~()-+=` 中任意3项密码"
},
{
"command": "extension.rule75",
"title": "$(rocket) zz: ASCII码表中的全部的特殊字符"
},
{
"command": "extension.rule76",
"title": "$(rocket) zz: 正整数不包含0" "title": "$(rocket) zz: 正整数不包含0"
}, },
{ {
"command": "extension.rule71", "command": "extension.rule77",
"title": "$(rocket) zz: 负整数不包含0" "title": "$(rocket) zz: 负整数不包含0"
}, },
{ {
"command": "extension.rule72", "command": "extension.rule78",
"title": "$(rocket) zz: 整数" "title": "$(rocket) zz: 整数"
}, },
{ {
"command": "extension.rule73", "command": "extension.rule79",
"title": "$(rocket) zz: 浮点数" "title": "$(rocket) zz: 浮点数"
}, },
{ {
"command": "extension.rule74", "command": "extension.rule80",
"title": "$(rocket) zz: 浮点数(严格)"
},
{
"command": "extension.rule81",
"title": "$(rocket) zz: email(支持中文邮箱)" "title": "$(rocket) zz: email(支持中文邮箱)"
}, },
{
"command": "extension.rule77",
"title": "$(rocket) zz: 车架号"
},
{ {
"command": "extension.rule.callByMenu", "command": "extension.rule.callByMenu",
"title": "🦕正则大全(75条)" "title": "🦕正则大全(83条)"
} }
] ]
}, },

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.13.1", "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

@ -98,7 +98,7 @@ module.exports = [{
}, },
{ {
title: 'md5格式(32位)', title: 'md5格式(32位)',
rule: /^([a-f\d]{32}|[A-F\d]{32})$/, rule: /^[a-fA-F0-9]{32}$/,
examples: ['21fe181c5bfc16306a6828c1f7b762e8'], examples: ['21fe181c5bfc16306a6828c1f7b762e8'],
}, },
{ {
@ -194,11 +194,26 @@ module.exports = [{
examples: ['008618311006933', '+8617888829981', '19119255642'] examples: ['008618311006933', '+8617888829981', '19119255642']
}, },
{ {
title: 'date(日期)', title: '日期(宽松)',
rule: /^\d{1,4}(-)(1[0-2]|0?[1-9])\1(0?[1-9]|[1-2]\d|30|31)$/, 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'] counterExamples: ['2020-00-01']
}, },
{
title: '日期(严谨, 支持闰年判断)',
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: ['1990-12-12', '2000-02-29'],
counterExamples: ['2021-02-29']
},
{
title: '中国省',
rule: /^浙江|上海|北京|天津|重庆|黑龙江|吉林|辽宁|内蒙古|河北|新疆|甘肃|青海|陕西|宁夏|河南|山东|山西|安徽|湖北|湖南|江苏|四川|贵州|云南|广西|西藏|江西|广东|福建|台湾|海南|香港|澳门$/,
examples: ['浙江', '台湾'],
counterExamples: ['哈尔滨']
},
{ {
title: '可以被moment转化成功的时间 YYYYMMDD HH:mm:ss', title: '可以被moment转化成功的时间 YYYYMMDD HH:mm:ss',
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: /^\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$/,
@ -254,8 +269,8 @@ module.exports = [{
examples: ['0.0', '0.09'] examples: ['0.0', '0.09']
}, },
{ {
title: '数字', title: '只包含数字',
rule: /^\d{1,}$/, rule: /^\d+$/,
examples: [12345678] examples: [12345678]
}, },
{ {
@ -263,6 +278,13 @@ module.exports = [{
rule: /<(\w+)[^>]*>(.*?<\/\1>)?/, rule: /<(\w+)[^>]*>(.*?<\/\1>)?/,
examples: ['<div id="app"> 2333 </div>', '<input type="text">', '<br>'] examples: ['<div id="app"> 2333 </div>', '<input type="text">', '<br>']
}, },
{
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]/,
examples: ["匹配中文汉字以及中文标点符号 。 “ ” ' 《 》 〈 〉 【 】 『 』 「 」 ﹃ ﹄ … — ¥"]
},
{ {
title: 'qq号格式正确', title: 'qq号格式正确',
rule: /^[1-9][0-9]{4,10}$/, rule: /^[1-9][0-9]{4,10}$/,
@ -371,11 +393,16 @@ module.exports = [{
examples: ['U193683453'] examples: ['U193683453']
}, },
{ {
title: '大写字母,小写字母,数字,特殊符号 `@#$%^&*`~()-+=` 中任意3项密码', title: '大写字母,小写字母,数字,特殊符号 `@#$%^&*`~()-+=` 中任意3项密码',
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: /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]/,
examples: ['a1@', 'A1@', 'Aa@'] examples: ['a1@', 'A1@', 'Aa@']
}, { },
{
title: 'ASCII码表中的全部的特殊字符',
rule: /[\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]+/,
examples: ["[", ".", "^", "&3%"]
},
{
title: '正整数不包含0', title: '正整数不包含0',
rule: /^\+?[1-9]\d*$/, rule: /^\+?[1-9]\d*$/,
examples: [1231] examples: [1231]
@ -387,18 +414,38 @@ module.exports = [{
}, },
{ {
title: '整数', title: '整数',
rule: /^-?[0-9]\d*$/, rule: /^(?:0|(?:-?[1-9]\d*))$/,
examples: [-1231, 123] examples: [-1231, 123, 0],
counterExamples: ['01']
}, },
{ {
title: '浮点数', title: '浮点数',
rule: /^(-?\d+)(\.\d+)?$/, rule: /^(-?[1-9]\d*\.\d+|-?0\.\d*[1-9]\d*|0\.0+)$/,
examples: [1.5] 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: /^(-?[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: 'email(支持中文邮箱)', title: 'email(支持中文邮箱)',
rule: /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/, rule: /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,
examples: ['90203918@qq.com', 'nbilly@126.com', '啦啦啦@126.com'] examples: ['90203918@qq.com', 'nbilly@126.com', '啦啦啦@126.com']
},
{
title: '域名(非网址, 不包含协议)',
rule: /^([0-9a-zA-Z-]{1,}\.)+([a-zA-Z]{2,})$/,
examples: ['www.baidu.com',
'baidu.com',
'baidu.com.cn',
'api.baidu.com',
'nodejs.org',
'nodejs.cn'],
counterExamples: ['http://baidu.com', 'https://baidu.com', 'www.百度.com']
} }
]; ];

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/'
: '/' // : '/'
} }

File diff suppressed because it is too large Load Diff

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**中添加.