regexControlCharacters
Reports control characters in regular expressions.
✅ This rule is included in the tslogicalandlogicalStrictpresets.
Reports control characters (code points U+0000 through U+001F) in regular expressions. Control characters in regex patterns are rarely intentional and can indicate a mistake or copy-paste error.
Examples
Section titled “Examples”Hex Escapes
Section titled “Hex Escapes”44AEcoUnicode Escapes
Section titled “Unicode Escapes”44AEcoControl Character Escapes
Section titled “Control Character Escapes”44AEcoOptions
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If your application intentionally processes binary data or protocols that use control characters, and you need to match them in regular expressions, you might prefer to disable this rule.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- Biome:
noControlCharactersInRegex - Deno:
no-control-regex - ESLint:
no-control-regexregexp/no-control-character - Oxlint:
eslint/no-control-regex
