Skip to content

Commit 05ae386

Browse files
authored
fix: typo
1 parent 00faad0 commit 05ae386

File tree

1 file changed

+2
-2
lines changed
  • 9-regular-expressions/07-regexp-escaping

1 file changed

+2
-2
lines changed

9-regular-expressions/07-regexp-escaping/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ alert( "Chapter 5.1".match(reg) ); // null
7171
alert("\d\.\d"); // d.d
7272
```
7373

74-
在字符串中的反斜杠表示转义或者类似 `\n` 这种只能在字符串中使用的特殊字符。这个引用会“消费”并且解释这些字符,比如说:
74+
在字符串中的反斜杠表示转义或者类似 `\n` 这种只能在字符串中使用的特殊字符。这个引用会“消耗”并且解释这些字符,比如说:
7575

7676
- `\n` —— 变成一个换行字符,
7777
- `\u1234` —— 变成该编码所对应的 Unicode 字符,
@@ -96,4 +96,4 @@ alert( "Chapter 5.1".match(regexp) ); // 5.1
9696

9797
- 要在字面意义上搜索特殊字符 `pattern:[ \ ^ $ . | ? * + ( )`,我们需要在它们前面加上一个反斜杠 `\`(“转义它们”)。
9898
- 如果在 `pattern:/.../` 内(但不在 `new RegExp` 内),我们还需要转义 `/`
99-
- 当将字符串传递给给 `new RegExp` 时,我们需要双反斜杠 `\\`因为字符串引号会消费一个反斜杠
99+
- 当将字符串传递给给 `new RegExp` 时,我们需要双反斜杠 `\\`因为字符串引号会消耗一个反斜杠

0 commit comments

Comments
 (0)