Consider to disallow Controls Characters in Regular Expressions |
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.
CheckId | SPC018904 |
---|---|
TypeName | NoControlCharactersInRegExp |
Severity | Warning |
Type | JavaScriptFile |
Bad Practice
var regexPattern = /\x21/
Good Practice
// Actually trying to match an encoded hexidecimal value in the textvar regexPattern = /\\x21/
Disclaimer: The views and opinions expressed in this documentation and in SPCAF do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. SPCAF and RENCORE are registered trademarks of Rencore. All other trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners.