Disallow Controls Characters in Regular Expressions (no-control-regex)
This rule is aimed at ensuring all regular expressions don’t use control characters.
The following patterns are considered problems:
/*eslint no-control-regex: 2*/ var pattern1 = /\\x1f/; var pattern2 = new RegExp("\x1f"); /*error Unexpected control character in regular expression.*/
The following patterns do not cause a warning:
/*eslint no-control-regex: 2*/ var pattern1 = /\\x20/; var pattern2 = new RegExp("\x20");
When Not To Use It
If you need to use control character pattern matching, then you should turn this rule off.
This rule was introduced in ESLint 0.1.0.