From 2a787a27e94fde260915f309f2f5442bc1c0f1ae Mon Sep 17 00:00:00 2001 From: CoolGuy Date: Fri, 25 Aug 2017 10:52:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF=20(#87)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根据https://github.com/zeeshanu/learn-regex/issues/86,英文文档部分已经更新了,所以更新一下中文文档部分 --- README-cn.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README-cn.md b/README-cn.md index b6e5191..31c3d86 100644 --- a/README-cn.md +++ b/README-cn.md @@ -359,10 +359,10 @@ 定义一个前置约束(存在)要使用 `()`. 在括号内部使用一个问号和等号: `(?=...)`. 前置约束的内容写在括号中的等号后面. -例如, 表达式 `[T|t]he(?=\sfat)` 匹配 `The` 和 `the`, 在括号中我们又定义了前置约束(存在) `(?=\sfat)` ,即 `The` 和 `the` 后面紧跟着 `(空格)fat`. +例如, 表达式 `(T|t)he(?=\sfat)` 匹配 `The` 和 `the`, 在括号中我们又定义了前置约束(存在) `(?=\sfat)` ,即 `The` 和 `the` 后面紧跟着 `(空格)fat`.
-"[T|t]he(?=\sfat)" => The fat cat sat on the mat.
+"(T|t)he(?=\sfat)" => The fat cat sat on the mat.
 
[在线练习](https://regex101.com/r/IDDARt/1) @@ -372,10 +372,10 @@ 前置约束-排除 `?!` 用于筛选所有匹配结果, 筛选条件为 其后不跟随着定义的格式 `前置约束-排除` 定义和 `前置约束(存在)` 一样, 区别就是 `=` 替换成 `!` 也就是 `(?!...)`. -表达式 `[T|t]he(?!\sfat)` 匹配 `The` 和 `the`, 且其后不跟着 `(空格)fat`. +表达式 `(T|t)he(?!\sfat)` 匹配 `The` 和 `the`, 且其后不跟着 `(空格)fat`.
-"[T|t]he(?!\sfat)" => The fat cat sat on the mat.
+"(T|t)he(?!\sfat)" => The fat cat sat on the mat.
 
[在线练习](https://regex101.com/r/V32Npg/1) @@ -383,10 +383,10 @@ ### 4.3 `?<= ...` 后置约束-存在 后置约束-存在 记作`(?<=...)` 用于筛选所有匹配结果, 筛选条件为 其前跟随着定义的格式. -例如, 表达式 `(?<=[T|t]he\s)(fat|mat)` 匹配 `fat` 和 `mat`, 且其前跟着 `The` 或 `the`. +例如, 表达式 `(?<=(T|t)he\s)(fat|mat)` 匹配 `fat` 和 `mat`, 且其前跟着 `The` 或 `the`.
-"(?<=[T|t]he\s)(fat|mat)" => The fat cat sat on the mat.
+"(?<=(T|t)he\s)(fat|mat)" => The fat cat sat on the mat.
 
[在线练习](https://regex101.com/r/avH165/1) @@ -397,7 +397,7 @@ 例如, 表达式 `(? -"(?<![T|t]he\s)(cat)" => The cat sat on cat. +"(?<!(T|t)he\s)(cat)" => The cat sat on cat. [在线练习](https://regex101.com/r/8Efx5G/1)