Skip to content

Commit 2a787a2

Browse files

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README-cn.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,10 @@
359359
定义一个前置约束(存在)要使用 `()`. 在括号内部使用一个问号和等号: `(?=...)`.
360360

361361
前置约束的内容写在括号中的等号后面.
362-
例如, 表达式 `[T|t]he(?=\sfat)` 匹配 `The``the`, 在括号中我们又定义了前置约束(存在) `(?=\sfat)` ,即 `The``the` 后面紧跟着 `(空格)fat`.
362+
例如, 表达式 `(T|t)he(?=\sfat)` 匹配 `The``the`, 在括号中我们又定义了前置约束(存在) `(?=\sfat)` ,即 `The``the` 后面紧跟着 `(空格)fat`.
363363

364364
<pre>
365-
"[T|t]he(?=\sfat)" => <a href="#learn-regex"><strong>The</strong></a> fat cat sat on the mat.
365+
"(T|t)he(?=\sfat)" => <a href="#learn-regex"><strong>The</strong></a> fat cat sat on the mat.
366366
</pre>
367367

368368
[在线练习](https://regex101.com/r/IDDARt/1)
@@ -372,21 +372,21 @@
372372
前置约束-排除 `?!` 用于筛选所有匹配结果, 筛选条件为 其后不跟随着定义的格式
373373
`前置约束-排除` 定义和 `前置约束(存在)` 一样, 区别就是 `=` 替换成 `!` 也就是 `(?!...)`.
374374

375-
表达式 `[T|t]he(?!\sfat)` 匹配 `The``the`, 且其后不跟着 `(空格)fat`.
375+
表达式 `(T|t)he(?!\sfat)` 匹配 `The``the`, 且其后不跟着 `(空格)fat`.
376376

377377
<pre>
378-
"[T|t]he(?!\sfat)" => The fat cat sat on <a href="#learn-regex"><strong>the</strong></a> mat.
378+
"(T|t)he(?!\sfat)" => The fat cat sat on <a href="#learn-regex"><strong>the</strong></a> mat.
379379
</pre>
380380

381381
[在线练习](https://regex101.com/r/V32Npg/1)
382382

383383
### 4.3 `?<= ...` 后置约束-存在
384384

385385
后置约束-存在 记作`(?<=...)` 用于筛选所有匹配结果, 筛选条件为 其前跟随着定义的格式.
386-
例如, 表达式 `(?<=[T|t]he\s)(fat|mat)` 匹配 `fat``mat`, 且其前跟着 `The``the`.
386+
例如, 表达式 `(?<=(T|t)he\s)(fat|mat)` 匹配 `fat``mat`, 且其前跟着 `The``the`.
387387

388388
<pre>
389-
"(?<=[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>.
389+
"(?<=(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>.
390390
</pre>
391391

392392
[在线练习](https://regex101.com/r/avH165/1)
@@ -397,7 +397,7 @@
397397
例如, 表达式 `(?<!(T|t)he\s)(cat)` 匹配 `cat`, 且其前不跟着 `The``the`.
398398

399399
<pre>
400-
"(?&lt;![T|t]he\s)(cat)" => The cat sat on <a href="#learn-regex"><strong>cat</strong></a>.
400+
"(?&lt;!(T|t)he\s)(cat)" => The cat sat on <a href="#learn-regex"><strong>cat</strong></a>.
401401
</pre>
402402

403403
[在线练习](https://regex101.com/r/8Efx5G/1)

0 commit comments

Comments
 (0)