mirror of
https://github.com/any86/any-rule.git
synced 2025-07-14 15:38:58 +08:00
feat: 新增"匹配中文汉字和中文标点"
This commit is contained in:
parent
c4b961531c
commit
574bbf8d8e
@ -4,6 +4,7 @@
|
||||
"displayName": "any-rule",
|
||||
"description": "你要的\"正则\"都在这!",
|
||||
"version": "0.3.13",
|
||||
"keywords": ["vscode","typescript", "regxp", "正则"],
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-push": "npm run test:rules"
|
||||
@ -25,6 +26,7 @@
|
||||
"vscode": "^1.12.0"
|
||||
},
|
||||
"categories": [
|
||||
"Snippets",
|
||||
"Other"
|
||||
],
|
||||
"icon": "images/vscode-logo.png",
|
||||
|
33
packages/www/src/RULES.js
vendored
33
packages/www/src/RULES.js
vendored
@ -21,7 +21,7 @@ module.exports = [{
|
||||
// 也参考谷歌浏览器的地址栏, 如果输入非字母不会被识别为域名
|
||||
title: '网址(URL)',
|
||||
rule: /^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,
|
||||
examples: ['www.qq.com','https://vuejs.org/v2/api/#v-model', 'www.qq.99', '//www.qq.com', 'www.腾讯.cs', 'ftp://baidu.qq', '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'],
|
||||
examples: ['www.qq.com', 'https://vuejs.org/v2/api/#v-model', 'www.qq.99', '//www.qq.com', 'www.腾讯.cs', 'ftp://baidu.qq', '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: ['....']
|
||||
},
|
||||
{
|
||||
@ -54,7 +54,7 @@ module.exports = [{
|
||||
{
|
||||
title: '子网掩码(不包含 0.0.0.0)',
|
||||
rule: /^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(255|254|252|248|240|224|192|128|0)$/,
|
||||
examples: ['255.255.255.0', '255.255.255.255','255.240.0.0']
|
||||
examples: ['255.255.255.0', '255.255.255.255', '255.240.0.0']
|
||||
},
|
||||
{
|
||||
title: 'linux"隐藏文件"路径',
|
||||
@ -202,8 +202,8 @@ module.exports = [{
|
||||
{
|
||||
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$/,
|
||||
examples: ['2020/01/01 23:59:59','2020-01-01 00:00:00', '20200101 11:11:11'],
|
||||
counterExamples: ['2020/00/01 23:59:59', '2020-01/01 23:59:59', '2020-01-01 23:59:61','2020-01-0100:00:00', ]
|
||||
examples: ['2020/01/01 23:59:59', '2020-01-01 00:00:00', '20200101 11:11:11'],
|
||||
counterExamples: ['2020/00/01 23:59:59', '2020-01/01 23:59:59', '2020-01-01 23:59:61', '2020-01-0100:00:00',]
|
||||
},
|
||||
{
|
||||
title: 'email(邮箱)',
|
||||
@ -254,8 +254,8 @@ module.exports = [{
|
||||
examples: ['0.0', '0.09']
|
||||
},
|
||||
{
|
||||
title: '数字',
|
||||
rule: /^\d{1,}$/,
|
||||
title: '只包含数字',
|
||||
rule: /^\d+$/,
|
||||
examples: [12345678]
|
||||
},
|
||||
{
|
||||
@ -263,6 +263,13 @@ module.exports = [{
|
||||
rule: /<(\w+)[^>]*>(.*?<\/\1>)?/,
|
||||
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号格式正确',
|
||||
rule: /^[1-9][0-9]{4,10}$/,
|
||||
@ -376,9 +383,9 @@ module.exports = [{
|
||||
examples: ['a1@', 'A1@', 'Aa@']
|
||||
},
|
||||
{
|
||||
title: 'ASCII码表中的全部的特殊字符',
|
||||
rule: /[\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]+/,
|
||||
examples: ["[", ".", "^", "&3%"]
|
||||
title: 'ASCII码表中的全部的特殊字符',
|
||||
rule: /[\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]+/,
|
||||
examples: ["[", ".", "^", "&3%"]
|
||||
},
|
||||
{
|
||||
title: '正整数,不包含0',
|
||||
@ -402,10 +409,10 @@ module.exports = [{
|
||||
// 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: '浮点数(严格)',
|
||||
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(支持中文邮箱)',
|
||||
|
Loading…
x
Reference in New Issue
Block a user