no-control-regex
Added in v0.5.0Configuration
rslint.config.ts
Rule Details
Disallows control characters (U+0000 through U+001F) in regular expressions. Control characters are rarely intended in patterns and usually indicate a typo.
The rule flags:
- Unescaped raw characters in the U+0000–U+001F range
\xHHescapes withHHin00–1F\uHHHHescapes withHHHHin0000–001F\u{H...}escapes (under theuorvflag) resolving to U+0000–U+001F
Symbolic control escapes such as \t, \n, \r, \v, \f, \0, and \cX are allowed.
Examples of incorrect code for this rule:
Examples of correct code for this rule: