mirror of
https://github.com/ziishaned/learn-regex.git
synced 2025-09-08 14:47:09 -04:00
Merge pull request #110 from EdgarAllanzp/master
Chinese translation at section 'Greedy vs lazy matching'.
This commit is contained in:
commit
f96987e415
15
README-cn.md
15
README-cn.md
@ -473,6 +473,21 @@
|
||||
|
||||
[在线练习](https://regex101.com/r/E88WE2/1)
|
||||
|
||||
### 6. 贪婪匹配与惰性匹配 (Greedy vs lazy matching)
|
||||
|
||||
正则表达式默认采用贪婪匹配模式,在该模式下意味着会匹配尽可能长的子串。我们可以使用 `?` 将贪婪匹配模式转化为惰性匹配模式。
|
||||
|
||||
<pre>
|
||||
"/(.*at)/" => <a href="#learn-regex"><strong>The fat cat sat on the mat</strong></a>. </pre>
|
||||
|
||||
[在线练习](https://regex101.com/r/AyAdgJ/1)
|
||||
|
||||
<pre>
|
||||
"/(.*?at)/" => <a href="#learn-regex"><strong>The fat</strong></a> cat sat on the mat. </pre>
|
||||
|
||||
|
||||
[在线练习](https://regex101.com/r/AyAdgJ/2)
|
||||
|
||||
## 贡献
|
||||
|
||||
* 报告问题
|
||||
|
Loading…
x
Reference in New Issue
Block a user