support \f and \v in the \s class

This commit is contained in:
Erik Krogh Kristensen
2020-11-02 10:36:11 +01:00
parent 68fe03060d
commit 2dd8b6ffef
3 changed files with 19 additions and 3 deletions

View File

@@ -327,8 +327,12 @@ private module CharacterClasses {
char = "0123456789".charAt(_)
or
cc.getValue() = "s" and
// TODO: also supposed to match \f and vertical tab (\x0B).
char = [" ", "\t", "\r", "\n"]
(
char = [" ", "\t", "\r", "\n", "\\u000c", "\\u000b"]
or
exists(RegExpConstant constant | constant.getValue().charAt(_) = char) and
char.regexpMatch("\\u000b|\\u000c") // \v|\f (vertical tab | form feed)
)
or
cc.getValue() = "w" and
char = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_".charAt(_)