JavaScript

JavaScript

Made by DeepSource

Found control characters in regular expressions JS-0004

Bug risk
Major

Control characters are special, invisible characters in the ASCII range 0-31. These characters are rarely used in JavaScript strings, so a regular expression containing these characters is most likely a mistake.

Bad Practice

const pattern1 = /\x1f/;
const pattern2 = new RegExp("\x1f");

Recommended

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