Skip to content

Commit

Permalink
Merge pull request any86#27 from any86/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
any86 authored Aug 23, 2019
2 parents 38ff071 + 5e94f78 commit 648c136
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 42 deletions.
9 changes: 3 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Change Log
# 更新日志

All notable changes to the "any-rule" extension will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## [Unreleased]
- 0.0.6
1. 修复"手机号(严禁)正则"错误.

- 0.0.5
1. 增加正则"迅雷链接" / "ed2k连接" / "磁力链接" / "子网掩码" / "linux文件(夹)路径" / "window文件(夹)路径"
Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 正则大全 ![](https://img.shields.io/badge/状态-积极更新-673ab7.svg) ![](https://img.shields.io/badge/已收录-57条-4caf50.svg) ![](https://badgen.net/vs-marketplace/v/russell.any-rule) ![](https://badgen.net/vs-marketplace/i/russell.any-rule) ![](https://badgen.net/vs-marketplace/d/russell.any-rule) ![](https://img.shields.io/badge/license-MIT-F44336.svg) [![CircleCI](https://circleci.com/gh/any86/any-rule.svg?style=svg)](https://circleci.com/gh/any86/any-rule)
# 正则大全 ![](https://img.shields.io/badge/状态-积极更新-673ab7.svg) ![](https://img.shields.io/badge/已收录-57条-4caf50.svg) ![](https://badgen.net/vs-marketplace/v/russell.any-rule) ![](https://badgen.net/vs-marketplace/i/russell.any-rule) ![](https://badgen.net/vs-marketplace/d/russell.any-rule) ![](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)

支持**图形界面** / **vscode插件**2种查询方式.

Expand Down Expand Up @@ -77,52 +77,52 @@ https://any86.github.io/any-rule/

### 版本号格式必须为X.Y.Z
```javascript
/^\d+(\.\d+){2}$/
/^\d+(?:\.\d+){2}$/
```

### 视频链接地址(视频格式可按需增删)
```javascript
/^https?:\/\/.*?(swf|avi|flv|mpg|rm|mov|wav|asf|3gp|mkv|rmvb|mp4)$/i
/^https?:\/\/.*?(?:swf|avi|flv|mpg|rm|mov|wav|asf|3gp|mkv|rmvb|mp4)$/i
```

### 图片链接地址(图片格式可按需增删)
```javascript
/^https?:\/\/.*?(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif)$/i
/^https?:\/\/.*?(?:gif|png|jpg|jpeg|webp|svg|psd|bmp|tif)$/i
```

### 24小时制时间(HH:mm:ss
```javascript
/^((?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$)/
/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/
```

### 12小时制时间(hh:mm:ss
```javascript
/^(1[0-2]|0?[1-9]):[0-5]\d:[0-5]\d$/
/^(?:1[0-2]|0?[1-9]):[0-5]\d:[0-5]\d$/
```

### base64格式
```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
```

### 数字/货币金额(支持负数、千分位分隔符)
```javascript
/(^[-]?[1-9]\d{0,2}($|(,\d{3})*($|(\.\d{1,2}$))))|((^[0](\.\d{1,2})?)|(^[-][0]\.\d{1,2}))$/
/(?:^[-]?[1-9]\d{0,2}(?:$|(?:,\d{3})*(?:$|(\.\d{1,2}$))))|(?:(?:^[0](\.\d{1,2})?)|(?:^[-][0]\.\d{1,2}))$/
```

### 数字/货币金额 (只支持正数、不支持校验千分位分隔符)
```javascript
/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
/(?:^[1-9]([0-9]+)?(?:\.[0-9]{1,2})?$)|(?:^(?:0){1}$)|(?:^[0-9]\.[0-9](?:[0-9])?$)/
```

### 银行卡号(16或19位)
```javascript
/^([1-9]{1})(\d{15}|\d{18})$/
/^(?:[1-9]{1})(?:\d{15}|\d{18})$/
```

### 中文姓名
```javascript
/^([\u4e00-\u9fa5·]{2,16})$/
/^(?:[\u4e00-\u9fa5·]{2,16})$/
```

### 英文姓名
Expand All @@ -142,27 +142,27 @@ https://any86.github.io/any-rule/

### 车牌号(新能源+非新能源)
```javascript
/^([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-HJ-NP-Z]{1}(([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9 挂学警港澳]{1})$/
/^(?:[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-HJ-NP-Z]{1}(?:(?:[0-9]{5}[DF])|(?:[DF](?:[A-HJ-NP-Z0-9])[0-9]{4})))|(?:[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9 挂学警港澳]{1})$/
```

### 网址
```javascript
/^((https?|ftp):\/\/)?([\da-z.-]+)\.([a-z.]{2,6})(\/\w\.-]*)*\/?/
/^(?:(?:https?|ftp):\/\/)?(?:[\da-z.-]+)\.(?:[a-z.]{2,6})(?:\/\w\.-]*)*\/?/
```

### 中国手机号(严谨), 根据工信部2019年最新公布的手机号段
```javascript
/^((\+|00)86)?1((3[\d])|(4[5,6,7,9])|(5[0-3,5-9])|(6[5-7])|(7[0-8])|(8[\d])|(9[1,8,9]))\d{8}$/
/^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-7|9])|(?:5[0-3|5-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[1|8|9]))\d{8}$/
```

### 中国手机号(宽松), 只要是13,14,15,16,17,18,19开头即可
```javascript
/^((\+|00)86)?1[3-9]\d{9}$/
/^(?:(?:\+|00)86)?1[3-9]\d{9}$/
```

### 中国手机号(最宽松), 只要是1开头即可, 如果你的手机号是用来接收短信, 优先建议选择这一条
```javascript
/^((\+|00)86)?1\d{10}$/
/^(?:(?:\+|00)86)?1\d{10}$/
```

### 日期
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publisher": "russell",
"displayName": "any-rule",
"description": "你要的\"正则\"都在这!",
"version": "0.0.5",
"version": "0.0.6",
"engines": {
"vscode": "^1.12.0"
},
Expand Down
36 changes: 18 additions & 18 deletions packages/www/src/RULES.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,53 +64,53 @@ module.exports = [
},
{
title: '版本号格式必须为X.Y.Z',
rule: /^\d+(\.\d+){2}$/,
rule: /^\d+(?:\.\d+){2}$/,
examples: ['16.3.10']
},
{
title: '视频链接地址(视频格式可按需增删)',
rule: /^https?:\/\/.*?(swf|avi|flv|mpg|rm|mov|wav|asf|3gp|mkv|rmvb|mp4)$/i,
rule: /^https?:\/\/.*?(?:swf|avi|flv|mpg|rm|mov|wav|asf|3gp|mkv|rmvb|mp4)$/i,
examples: ['http://www.abc.com/video/wc.avi']
},
{
title: '图片链接地址(图片格式可按需增删)',
rule: /^https?:\/\/.*?(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif)$/i,
rule: /^https?:\/\/.*?(?:gif|png|jpg|jpeg|webp|svg|psd|bmp|tif)$/i,
examples: ['https://www.abc.com/logo.png']
},
{
title: '24小时制时间(HH:mm:ss)',
rule: /^((?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$)/,
rule: /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/,
examples: ['23:34:55']
},
{
title: '12小时制时间(hh:mm:ss)',
rule: /^(1[0-2]|0?[1-9]):[0-5]\d:[0-5]\d$/,
rule: /^(?:1[0-2]|0?[1-9]):[0-5]\d:[0-5]\d$/,
examples: ['11:34:55'],
counterExamples: ['23:34:55']
},
{
title: 'base64格式',
rule: /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@/?%\s]*?)\s*$/i,
rule: /^\s*data:(?:[a-z]+\/[a-z0-9-+.]+(?:;[a-z-]+=[a-z0-9-]+)?)?(?:;base64)?,([a-z0-9!$&',()*+;=\-._~:@/?%\s]*?)\s*$/i,
examples: ['data:image/gif;base64,xxxx==']
},
{
title: '数字/货币金额(支持负数、千分位分隔符)',
rule: /(^[-]?[1-9]\d{0,2}($|(,\d{3})*($|(\.\d{1,2}$))))|((^[0](\.\d{1,2})?)|(^[-][0]\.\d{1,2}))$/,
rule: /(?:^[-]?[1-9]\d{0,2}(?:$|(?:,\d{3})*(?:$|(\.\d{1,2}$))))|(?:(?:^[0](\.\d{1,2})?)|(?:^[-][0]\.\d{1,2}))$/,
examples: [100, -0.99, 3, 234.32, -1, 900, 235.09]
},
{
title: '数字/货币金额 (只支持正数、不支持校验千分位分隔符)',
rule: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
rule: /(?:^[1-9]([0-9]+)?(?:\.[0-9]{1,2})?$)|(?:^(?:0){1}$)|(?:^[0-9]\.[0-9](?:[0-9])?$)/,
examples: [0.99, 8.99, 666]
},
{
title: '银行卡号(16或19位)',
rule: /^([1-9]{1})(\d{15}|\d{18})$/,
rule: /^(?:[1-9]{1})(?:\d{15}|\d{18})$/,
examples: [6222026006705354217]
},
{
title: '中文姓名',
rule: /^([\u4e00-\u9fa5·]{2,16})$/,
rule: /^(?:[\u4e00-\u9fa5·]{2,16})$/,
examples: ['葛二蛋', '凯文·杜兰特', '德克·维尔纳·诺维茨基']
},
{
Expand All @@ -130,28 +130,28 @@ module.exports = [
},
{
title: '车牌号(新能源+非新能源)',
rule: /^([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-HJ-NP-Z]{1}(([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9 挂学警港澳]{1})$/,
rule: /^(?:[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-HJ-NP-Z]{1}(?:(?:[0-9]{5}[DF])|(?:[DF](?:[A-HJ-NP-Z0-9])[0-9]{4})))|(?:[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领 A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9 挂学警港澳]{1})$/,
examples: ['京A12345D', '京A00599']
},
{
title: '网址',
rule: /^((https?|ftp):\/\/)?([\da-z.-]+)\.([a-z.]{2,6})(\/\w\.-]*)*\/?/,
rule: /^(?:(?:https?|ftp):\/\/)?(?:[\da-z.-]+)\.(?:[a-z.]{2,6})(?:\/\w\.-]*)*\/?/,
examples: ['www.qq.com']
},
{
title: '中国手机号(严谨), 根据工信部2019年最新公布的手机号段',
rule: /^((\+|00)86)?1((3[\d])|(4[5,6,7,9])|(5[0-3,5-9])|(6[5-7])|(7[0-8])|(8[\d])|(9[1,8,9]))\d{8}$/,
examples: ['18311006933', '17888829981']
rule: /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-7|9])|(?:5[0-3|5-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[1|8|9]))\d{8}$/,
examples: ['008618311006933', '+8617888829981', '19119255642']
},
{
title: '中国手机号(宽松), 只要是13,14,15,16,17,18,19开头即可',
rule: /^((\+|00)86)?1[3-9]\d{9}$/,
examples: ['18311006933', '17888829981']
rule: /^(?:(?:\+|00)86)?1[3-9]\d{9}$/,
examples: ['008618311006933', '+8617888829981', '19119255642']
},
{
title: '中国手机号(最宽松), 只要是1开头即可, 如果你的手机号是用来接收短信, 优先建议选择这一条',
rule: /^((\+|00)86)?1\d{10}$/,
examples: ['18311006933', '17888829981']
rule: /^(?:(?:\+|00)86)?1\d{10}$/,
examples: ['008618311006933', '+8617888829981', '19119255642']
},
{
title: '日期',
Expand Down
2 changes: 1 addition & 1 deletion scripts/md.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs');
const chalk = require('chalk');
const json = require('../packages/www/src/RULES');
let content = `# 正则大全 ![](https://img.shields.io/badge/状态-积极更新-673ab7.svg) ![](https://img.shields.io/badge/已收录-${json.length}条-4caf50.svg) ![](https://badgen.net/vs-marketplace/v/russell.any-rule) ![](https://badgen.net/vs-marketplace/i/russell.any-rule) ![](https://badgen.net/vs-marketplace/d/russell.any-rule) ![](https://img.shields.io/badge/license-MIT-F44336.svg) [![CircleCI](https://circleci.com/gh/any86/any-rule.svg?style=svg)](https://circleci.com/gh/any86/any-rule)
let content = `# 正则大全 ![](https://img.shields.io/badge/状态-积极更新-673ab7.svg) ![](https://img.shields.io/badge/已收录-${json.length}条-4caf50.svg) ![](https://badgen.net/vs-marketplace/v/russell.any-rule) ![](https://badgen.net/vs-marketplace/i/russell.any-rule) ![](https://badgen.net/vs-marketplace/d/russell.any-rule) ![](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)
支持**图形界面** / **vscode插件**2种查询方式.
Expand Down

0 comments on commit 648c136

Please sign in to comment.