You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The empty string is the only match: it starts and immediately finishes.
3
3
4
-
The task once again demonstrates that anchors are not characters, but tests.
5
4
6
-
The string is empty `""`. The engine first matches the `pattern:^` (input start), yes it's there, and then immediately the end `pattern:$`, it's here too. So there's a match.
A two-digit hex number is `pattern:[0-9a-f]{2}` (assuming the `pattern:i` flag is enabled).
1
+
两位十六进制数的模式是 `[0-9a-f]{2}`(假设 `i` flag 已被启用)。
2
2
3
-
We need that number `NN`, and then `:NN`repeated 5 times (more numbers);
3
+
我们需要一个 `NN` 这种形状的数字,和五个 `:NN`形状的数字。
4
4
5
-
The regexp is: `pattern:[0-9a-f]{2}(:[0-9a-f]{2}){5}`
5
+
最终的正则表达式是:`pattern:[0-9a-f]{2}(:[0-9a-f]{2}){5}`
6
6
7
-
Now let's show that the match should capture all the text: start at the beginning and end at the end. That's done by wrapping the pattern in `pattern:^...$`.
That's because by default a caret `pattern:^`only matches at the beginning of the text, and in the multiline mode -- at the start of a line.
36
+
这是因为默认情况下,锚符 `^`仅仅匹配文本的开头,在多行模式下——它匹配行的开头。
37
37
38
-
The regular expression engine moves along the text and looks for a string start `pattern:^`, when finds -- continues to match the rest of the pattern `pattern:\d+`.
0 commit comments