regexControlCharacterEscapes
Reports control characters that are not escaped using standard escape sequences.
✅ This rule is included in the tslogicalandlogicalStrictpresets.
Enforces consistent escaping of control characters in regular expressions by requiring standard escape sequences (\0, \t, \n, \v, \f, \r) instead of hex, unicode, or control character escapes.
Examples
Section titled “Examples”Hex Escapes
Section titled “Hex Escapes”44AEcoUnicode Escapes
Section titled “Unicode Escapes”44AEcoControl Character Escapes
Section titled “Control Character Escapes”44AEcoUnicode Code Point Escapes
Section titled “Unicode Code Point Escapes”44AEcoOptions
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If your codebase has an established convention of using hex or unicode escapes for control characters, or if you need consistency with generated code that uses these formats, you may disable this rule.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- ESLint:
regexp/control-character-escape
