All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.javascript.rules.javascript.S6324.html Maven / Gradle / Ivy

There is a newer version: 10.17.0.28100
Show newest version

Why is this an issue?

Entries in the ASCII table below code 32 are known as control characters or non-printing characters. As they are not common in JavaScript strings, using these invisible characters in regular expressions is most likely a mistake.

const pattern1 = /\x1a/;             // Noncompliant: 1a (23 base 10) is less than 32
const pattern2 = new RegExp('\x1a'); // Noncompliant: 1a (23 base 10) is less than 32

Instead, one should only match printable characters in regular expressions.

const pattern1 = /\x20/;
const pattern2 = new RegExp('\x20');

Resources

Documentation





© 2015 - 2024 Weber Informatics LLC | Privacy Policy