feat: Increase number-related regular verification

This commit is contained in:
songjian 2021-10-13 16:12:45 +08:00
parent e0fcb8259b
commit df9a5ac291
3 changed files with 41 additions and 5 deletions

View File

@ -410,3 +410,23 @@ 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+)?$/
```

View File

@ -341,6 +341,22 @@
"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.rule.callByMenu",
"title": "🦕正则大全(70条)"

View File

@ -243,6 +243,11 @@ module.exports = [{
rule: /^\d+\.\d+$/,
examples: ['0.0', '0.09']
},
{
title: '数字',
rule: /^\d{1,}$/,
examples: [12345678]
},
{
title: 'html标签(宽松匹配)',
rule: /<(\w+)[^>]*>(.*?<\/\1>)?/,
@ -353,11 +358,6 @@ module.exports = [{
rule: /^[a-zA-Z][0-9]{9}$/,
examples: ['U193683453']
},
{
title: '数字',
rule: /^\d{1,}$/,
examples: [12345678]
},
{
title: '正整数不包含0',
rule: /^\+?[1-9]\d*$/,