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
Copy file name to clipboardExpand all lines: docs/rules/no-octal.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,9 +13,11 @@ since: "v0.1.0"
13
13
14
14
## :book: Rule Details
15
15
16
-
This rule reports octal escape.
16
+
This rule reports octal escapes.
17
17
18
-
`\0` is matches a `NUL` character. Do not follow this with another digit, because a 0 followed by a number is an octal escape sequence.
18
+
`\0` matches the `NUL` character. However, if `\0` is followed by another digit, it will become an octal escape sequence (e.g. `\07`).
19
+
20
+
Octal escapes can also easily be confused with backreferences. The same character sequence (e.g. `\3`) can either escape a character or be a backreference depending on the number of capturing groups in the pattern. E.g. the `\2` in `/(a)\2/` is a character but the `\2` in `/(a)(b)\2/` is a backreference. This can be a problem when refactoring regular expressions because an octal escape can become a backreference or vice versa.
19
21
20
22
<eslint-code-block>
21
23
@@ -25,9 +27,11 @@ This rule reports octal escape.
0 commit comments