mirror of
https://github.com/ziishaned/learn-regex.git
synced 2025-08-06 03:26:42 -04:00
修复错误 (#87)
根据https://github.com/zeeshanu/learn-regex/issues/86,英文文档部分已经更新了,所以更新一下中文文档部分
This commit is contained in:
parent
fc7473cd78
commit
2a787a27e9
14
README-cn.md
14
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`.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
"[T|t]he(?=\sfat)" => <a href="#learn-regex"><strong>The</strong></a> fat cat sat on the mat.
|
"(T|t)he(?=\sfat)" => <a href="#learn-regex"><strong>The</strong></a> fat cat sat on the mat.
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
[在线练习](https://regex101.com/r/IDDARt/1)
|
[在线练习](https://regex101.com/r/IDDARt/1)
|
||||||
@ -372,10 +372,10 @@
|
|||||||
前置约束-排除 `?!` 用于筛选所有匹配结果, 筛选条件为 其后不跟随着定义的格式
|
前置约束-排除 `?!` 用于筛选所有匹配结果, 筛选条件为 其后不跟随着定义的格式
|
||||||
`前置约束-排除` 定义和 `前置约束(存在)` 一样, 区别就是 `=` 替换成 `!` 也就是 `(?!...)`.
|
`前置约束-排除` 定义和 `前置约束(存在)` 一样, 区别就是 `=` 替换成 `!` 也就是 `(?!...)`.
|
||||||
|
|
||||||
表达式 `[T|t]he(?!\sfat)` 匹配 `The` 和 `the`, 且其后不跟着 `(空格)fat`.
|
表达式 `(T|t)he(?!\sfat)` 匹配 `The` 和 `the`, 且其后不跟着 `(空格)fat`.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
"[T|t]he(?!\sfat)" => The fat cat sat on <a href="#learn-regex"><strong>the</strong></a> mat.
|
"(T|t)he(?!\sfat)" => The fat cat sat on <a href="#learn-regex"><strong>the</strong></a> mat.
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
[在线练习](https://regex101.com/r/V32Npg/1)
|
[在线练习](https://regex101.com/r/V32Npg/1)
|
||||||
@ -383,10 +383,10 @@
|
|||||||
### 4.3 `?<= ...` 后置约束-存在
|
### 4.3 `?<= ...` 后置约束-存在
|
||||||
|
|
||||||
后置约束-存在 记作`(?<=...)` 用于筛选所有匹配结果, 筛选条件为 其前跟随着定义的格式.
|
后置约束-存在 记作`(?<=...)` 用于筛选所有匹配结果, 筛选条件为 其前跟随着定义的格式.
|
||||||
例如, 表达式 `(?<=[T|t]he\s)(fat|mat)` 匹配 `fat` 和 `mat`, 且其前跟着 `The` 或 `the`.
|
例如, 表达式 `(?<=(T|t)he\s)(fat|mat)` 匹配 `fat` 和 `mat`, 且其前跟着 `The` 或 `the`.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
"(?<=[T|t]he\s)(fat|mat)" => The <a href="#learn-regex"><strong>fat</strong></a> cat sat on the <a href="#learn-regex"><strong>mat</strong></a>.
|
"(?<=(T|t)he\s)(fat|mat)" => The <a href="#learn-regex"><strong>fat</strong></a> cat sat on the <a href="#learn-regex"><strong>mat</strong></a>.
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
[在线练习](https://regex101.com/r/avH165/1)
|
[在线练习](https://regex101.com/r/avH165/1)
|
||||||
@ -397,7 +397,7 @@
|
|||||||
例如, 表达式 `(?<!(T|t)he\s)(cat)` 匹配 `cat`, 且其前不跟着 `The` 或 `the`.
|
例如, 表达式 `(?<!(T|t)he\s)(cat)` 匹配 `cat`, 且其前不跟着 `The` 或 `the`.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
"(?<![T|t]he\s)(cat)" => The cat sat on <a href="#learn-regex"><strong>cat</strong></a>.
|
"(?<!(T|t)he\s)(cat)" => The cat sat on <a href="#learn-regex"><strong>cat</strong></a>.
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
[在线练习](https://regex101.com/r/8Efx5G/1)
|
[在线练习](https://regex101.com/r/8Efx5G/1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user