Reports octal escape sequences in regular expressions.
Octal escapes like \7 or \07 can be confused with backreferences.
The same sequence (e.g., \2) may be a character or a backreference depending on the number of capturing groups in the pattern.
Error ts(1534) ― This backreference refers to a group that does not exist. There are no capturing groups in this regular expression.
Error ts(1534) ― This backreference refers to a group that does not exist. There are no capturing groups in this regular expression.
const
const pattern:RegExp
pattern =/\x01\x02/;
In the incorrect example, \1 and \2 are octal escapes (matching characters with code 1 and 2).
If capturing groups are added later, they could become backreferences.
If you intentionally use octal escapes for specific character matching and understand the distinction from backreferences, you might want to disable this rule.
Octal escapes inside character class ranges (e.g., [\1-\4]) are allowed.