From 1c6162b7e9f77bde8e49ae3a4b99c0fa22d23b0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E9=9B=84?= <3218770186@qq.com> Date: Thu, 17 Nov 2022 05:01:03 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=BB=BA=2011.16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "30\351\273\204\351\233\204/11.16/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "30\351\273\204\351\233\204/11.16/.keep" diff --git "a/30\351\273\204\351\233\204/11.16/.keep" "b/30\351\273\204\351\233\204/11.16/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From 9bbe72e0b7f102484147b8b018a4898cfbfc75d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E9=9B=84?= <3218770186@qq.com> Date: Thu, 17 Nov 2022 05:01:57 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E9=BB=84=E9=9B=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄雄 <3218770186@qq.com> --- "30\351\273\204\351\233\204/11.16/11.16.html" | 28 +++++++++ "30\351\273\204\351\233\204/11.16/zuoye.md" | 59 +++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 "30\351\273\204\351\233\204/11.16/11.16.html" create mode 100644 "30\351\273\204\351\233\204/11.16/zuoye.md" diff --git "a/30\351\273\204\351\233\204/11.16/11.16.html" "b/30\351\273\204\351\233\204/11.16/11.16.html" new file mode 100644 index 0000000..0dabfdc --- /dev/null +++ "b/30\351\273\204\351\233\204/11.16/11.16.html" @@ -0,0 +1,28 @@ + + + + + + + Document + + + + + \ No newline at end of file diff --git "a/30\351\273\204\351\233\204/11.16/zuoye.md" "b/30\351\273\204\351\233\204/11.16/zuoye.md" new file mode 100644 index 0000000..a88005d --- /dev/null +++ "b/30\351\273\204\351\233\204/11.16/zuoye.md" @@ -0,0 +1,59 @@ +//自左向右匹配,一旦匹配上 就不再回头(数字排列时由大到小先十位后个位) +// console.log(/[1-9][\d]|\d/.exec('9')); +//反捕获:?::将捕获到的子表达式隐藏 +//?=:紧跟着 ?!:不紧跟着 ?:-->反捕获 ??--> 非贪婪{0,1} + +可以用括号来分隔数据 并改变类似于数组(0为要查询的的'2018-10-18'1为第一个括号框起来的数字) +// console.log(/(\d{4})-(\d{2})-(\d{2})/.exec('2018-10-18')); +可以用regExp.$1来输出第一个数字是什么,$2就是第二个 +// console.log(RegExp.$1); + +\g 全局匹配 +// console.log( '1a,2a,3a'.replace(/a/g,'b')); +\i 不区分大小写 +// console.log( '1a,2a,3a,1A'.match(/1a/ig)); +\b单词边界 +// console.log(/e\b/.exec('eapples')); +| 或者的意思 +// 文件名由字母、数字、下划线构成,不可以以数字开头,后缀为.zip/rar/gz +// console.log(/[^\d]*\.zip|rar|gz/.exec('zip.zip')); + +[\u4e00-\u9fa5]中文 +//单词边界:\b + +转义字符**(\)对特殊符号进行转义,比如-代表区间,\-就变成了单纯的-符号 + +非/取反**(^)可以匹配任何指定字符之外的所有字符,区间取反要放到大括号里面,放在开头表示要以啥啥开头 + +结尾**($)表示必须以啥啥结尾 + +快捷取反**(小写改大写)比如\d匹配数字,\D匹配除数字以外的玩意 + +快捷匹配数字**(\d) + +快捷匹配字母**(\w)与任意单词字符匹配,包含A-z,a-z,0-9,_ + +匹配空白字符**(\s)例如空格,tab,换行等 + +单词边界**(\b)一个字符旁边必须是啥的时候用 + +匹配任意单个字符**(.)除了换行 + +匹配一到无数个**(+) + +匹配零到无数个**(*) +可选字符**(?)表示可有可无 +环视 +?=:紧跟着 ?!:不紧跟着 ?:-->反捕获 ??--> 非贪婪{0,1} + +查b (由c紧跟着) +// console.log(/b(?=c)/.exec('abcbd')); + +查a (后面跟的不是b) +console.log(/a(?!b)/.exec('abca')); + +异常处理 +//try:尝试捕获异常,里面放的是可能出错的代码 +//1.报错之后的代码中止执行 +//2.每次只能捕获一个异常 +*区间**(-) -- Gitee