From 63be985d6b05ee8ee87ca2d93f3dbe16d88868e4 Mon Sep 17 00:00:00 2001 From: smilelc3 Date: Wed, 6 Dec 2023 23:46:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E5=88=99=E8=A1=A8=E8=BE=BE=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RegEx-Logo.webp" | Bin 0 -> 6994 bytes ...31\350\241\250\350\276\276\345\274\217.md" | 39 ++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 "images/\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217/RegEx-Logo.webp" create mode 100644 "markdown/\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217.md" diff --git "a/images/\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217/RegEx-Logo.webp" "b/images/\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217/RegEx-Logo.webp" new file mode 100644 index 0000000000000000000000000000000000000000..12727c0c1faf2ea271822e3360612c2657d967be GIT binary patch literal 6994 zcmV-Y8?EG0Nk&FW8vp=TMM6+kP&gny8vp=Mb^x6LDy{*{06uLpmPjNbqM@ZxYY2c1 ziA~%s-7@7jO22x3 z{}1k`^w<4wa4*!4`ajx#$97Hg8~df}2me>r_x8V0f8(F|I^g{hJi32%ek8wXziU7L z=AHdJx)1MvALlhq>?Vf7y6%^0WKjP+!Tvng5vl zy8grTQ3Iz0dqed9_g~$AbbrJA!TmS7Kw}&_A*N;r5CD z3;(D3Ps!hMzfgbc|5xx8{LlNJ{BQ8S+GK)zhz?KHi8s}2yJy>dBtwuMV+Ili8?Ah`K%152D z2+a3Qk7HRwK+|RdghQc%s(~zs=Y4dsA?vO*N89i~^yyKGQT4)VIC{ok@VYD2z1it- zcF^PM3i%cu;Abd8E{>Y+ z$8Vb6+&3avC2;opt#6z@Ou{w5TId^Bg_dR0)8IhAS$z1y26N6dMPi$lvi~8$Z zU4LC`Yp?65x*$};5x3dVu(bob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X3;G)r3O%Ctu?b|_%n(e^5VAX&8KPH|YT2&Hk`!S>oQ$N!|eqavPim459KdZE9 zjSnFGyseQ^G}vj@0V%UQ^>r>3ieVzQFi^Zbn0(9x>9B?;Ee?p9!IL!96e_`L#fcVN zVh93*6Al{-C(2gH7xw-IN<9>gqPYF70}jwU0PbM2d+M6=+Ft33rtn--r-eq=Ecl5i zS}y~~mB$gFH)q_w5w-T7NrWCchPVsrk^=f?P$R%g&?FHQ-w* z;A`m@ zkkKf}DAyG(JhU7rD+LCZw}s>L z%T3Yy;n8hZg6JQGrS!<@e-dMFT(jYbVC&@-&I*o_y<#DxOI=sv1m;p2u-;-o@yfLZ z&s2k~=^LsvF8LO)Qeb`jIL@U^63dRpX$|scL+mV-F6sbY^NBXwK&7y~47H}?iO;*n z8`COl03N07N6xS>*)iTOc~vX_=Z=Vg6h`xZEaKhlF|cF)^d0W2P=ulm*$rRH^R>wm z^yGsZQ19h{{kwDi2%Zh1rm!?$G~37F$4CEf@E~DuURD&Ul5jOIKYeptSeRphIXFqI{1btE k&nNX;vFwYg1H8F(&XZaR*$9hX4Qo literal 0 HcmV?d00001 diff --git "a/markdown/\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217.md" "b/markdown/\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217.md" new file mode 100644 index 0000000..4b4fd20 --- /dev/null +++ "b/markdown/\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217.md" @@ -0,0 +1,39 @@ +--- +title: 正则表达式 +date: 2023-12-06 +--- + +![](https://raw.githubusercontent.com/smilelc3/blog/main/images/正则表达式/RegEx-Logo.webp) + +# 正则表达式 + +## 常用表达式语法 + +| 语法 | 描述 | 用例 | +|:---:|:---|:---| +| \\ | 将下一个字符标记为一个特殊字符、或一个原义字符、或一个向后引用、或一个进制转义符。| “n”匹配字符“n”。“\\n”匹配一个换行符。连续“\\\\”匹配“\”,而“\\(”匹配“(” | +| ^ | 匹配输入字符串的**开始位置**| | +| $ | 匹配输入字符串的**结束位置**| | +| * | 匹配前面的子表达式**零次或多次**。*等价于{0,}| “zo*”能匹配“z”以及“zoo” | +| + | 匹配前面的子表达式**一次或多次**。+等价于{1,} | “zo+”能匹配“zo”以及“zoo”,但不能匹配“z” | +| ? | 匹配前面的子表达式**零次或一次**。?等价于{0,1} | “password(s)?”可以匹配“pawwsord”或“passwords” | +| {n} | n是一个非负整数。**必须匹配n次** | “fo{2}d”不能匹配“fo”,但是能匹配“foo” | +| {n,} | n是一个非负整数。**至少匹配n次** | “go{2,}d”不能匹配“god”,但是能匹配“good”和“gooood” | +| {n,m} | m和n均为非负整数,其中n<=m。**最少匹配n次且最多匹配m次**,请注意在逗号和两个数之间不能有空格。 | | +| ? | 当该字符紧跟在任何一个其他限制符(*,+,?, {n}, {n,}, {n,m})后面时,**匹配模式是非贪婪的**。非贪婪模式尽可能少的匹配所搜索的字符串,而默认的贪婪模式则尽可能多的匹配所搜索的字符串| 对于字符串“oooo”,“o+?”将匹配单个“o”,而“o+”将匹配所有“o” | +| . | 匹配除“\\n”之外的**任何单个字符**。要匹配包括“\\n”在内的任何字符,请使用像“(.\|\\n)”的模式。| | +| (pattern) | 匹配pattern并获取这一匹配。所获取的匹配可以从产生的Matches集合得到,要匹配圆括号字符,请使用“`\(`” 或 “`\)`” | | +| x\|y | **匹配x或y**,也可以多个一起使用“x\|y\|z” | “(b\|f)oo”能匹配“boo”或“foo”。“b\|foo”则匹配“b”或“foo” | +| [xyz] | 匹配**所包含的任意一个字符** | “[abc]{2}”可以匹配“aa”或“ac”或“bb”等 | +| [^xyz] | 匹配**未包含的任意一个字符** | | +| [a-z] | 字符范围。匹配**指定范围内的任意字符** | “[a-z]+”可以匹配任意长度的小写字母字符串 | +| \\d | 匹配**一个数字字符**。等价于[0-9] | | +| \\D | 匹配**一个非数字字符**。等价于[^0-9] | | +| \\n | 匹配**一个换行符**。等价于\\x0a | | +| \\r | 匹配**一个回车符**。等价于\\x0d | | +| \\s | 匹配**一个任何空白字符**,包括空格、制表符、换页符等等。等价于[\\f\\n\\r\\t\\v] | | +| \\S | 匹配**一个任何非空白字符**,等价于[^\\f\\n\\r\\t\\v] | | +| \\t | 匹配**一个制表符**。等价于\x09 | | +| \\w | 匹配一个包括下划线的任何单词字符。等价于“[A-Za-z0-9_]” | | +| \\W | 匹配任何非单词字符。等价于“[^A-Za-z0-9_]” | | +| \\un| 匹配n,其中n是一个用四个十六进制数字表示的Unicode字符 | \\u00A9匹配版权符号(©),[\\u4e00-\\u9fa5]匹配中文字符 |