mirror of
https://github.com/any86/any-rule.git
synced 2025-07-14 15:38:58 +08:00
Merge pull request #201 from songjianet/develop-number
feat: Increase number-related regular verification
This commit is contained in:
commit
8fd08708dc
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
|
||||
|
25
README.md
25
README.md
@ -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
@ -341,6 +341,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条)"
|
||||
|
29
packages/www/src/RULES.js
vendored
29
packages/www/src/RULES.js
vendored
@ -17,7 +17,7 @@ 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'],
|
||||
examples: ['www.qq.com', 'https://baidu.com', 'http://baidu.com', '360.com:8080/vue/#/a=1&b=2'],
|
||||
counterExamples: ['....']
|
||||
},
|
||||
{
|
||||
@ -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)',
|
||||
@ -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