Nucleus handler tools › Docs › Checks

A control character in a regular expression

Infono-control-regexA general JavaScript mistake (ESLint's no-control-regex) · Worth knowing: it works, with a catch.

Why it matters

A control character in a regular expression is almost always a mistake (a lost backslash).

Example

✗ Wrong

var r = /\x0C/;

✓ Right

var r = /\f/;

How to fix it

Write the character you meant, usually an escaped backslash.

Turn it off, or change how it shows

Each check can be shown as an error, warning, info or hint, or turned off. VS Code: "splitscreenme.lint.rules": { "no-control-regex": "off" } in your settings. Notepad++: Plugins › Nucleus Co-op handlers › Settings. Command line: ncdev lint --rule no-control-regex=off. Other editors: the lint.rules setting of ncdev lsp.

Is this right? Tell us what's wrong
Stuck, or not sure? Ask other handler authors: Discordr/nucleuscoop