mirror of
https://github.com/ziishaned/learn-regex.git
synced 2025-08-06 03:26:42 -04:00
Something really need to be clarified (#48)
* Something really need to be clarified the `+` is tricky * add explanation on the optional ? Thanks for the great project , hope this can help to clarify a bit in Chinese * Change a bit on . some typo corrected
This commit is contained in:
parent
3cb7983839
commit
499de93acd
@ -261,7 +261,7 @@
|
||||
|
||||
反斜线 `\` 在表达式中用于转码紧跟其后的字符. 用于指定 `{ } [ ] / \ + * . $ ^ | ?` 这些特殊字符. 如果想要匹配这些特殊字符则要在其前面加上反斜线 `\`.
|
||||
|
||||
例如 `.` 是用来匹配除换行符外的所有字符的. 如果想要匹配句子中的 `.` 则要写成 `\.`.
|
||||
例如 `.` 是用来匹配除换行符外的所有字符的. 如果想要匹配句子中的 `.` 则要写成 `\.` 以下这个例子 `\.?`是选择性匹配`.`
|
||||
|
||||
<pre>
|
||||
"(f|c|m)at\.?" => The <a href="#learn-regex"><strong>fat</strong></a> <a href="#learn-regex"><strong>cat</strong></a> sat on the <a href="#learn-regex"><strong>mat.</strong></a>
|
||||
|
@ -176,7 +176,7 @@ zero or more spaces.
|
||||
### 2.3.2 The Plus
|
||||
|
||||
The symbol `+` matches one or more repetitions of the preceding character. For example, the regular expression `c.+t` means: lowercase
|
||||
letter `c`, followed by at least one character, followed by the lowercase character `t`.
|
||||
letter `c`, followed by at least one character, followed by the lowercase character `t`. It needs to be clarified that `t` is the last `t` in the sentence.
|
||||
|
||||
<pre>
|
||||
"c.+t" => The fat <a href="#learn-regex"><strong>cat sat on the mat</strong></a>.
|
||||
|
Loading…
x
Reference in New Issue
Block a user