diff --git a/ql/src/codeql_ruby/regexp/RegExpTreeView.qll b/ql/src/codeql_ruby/regexp/RegExpTreeView.qll index b28fab47ed4..86003a9a888 100644 --- a/ql/src/codeql_ruby/regexp/RegExpTreeView.qll +++ b/ql/src/codeql_ruby/regexp/RegExpTreeView.qll @@ -399,12 +399,7 @@ class RegExpEscape extends RegExpNormalChar { * ``` */ class RegExpCharacterClassEscape extends RegExpEscape { - // string value; - RegExpCharacterClassEscape() { - // value = re.getText().substring(start + 1, end) and - // value in ["d", "D", "s", "S", "w", "W"] - this.getValue() in ["d", "D", "s", "S", "w", "W"] - } + RegExpCharacterClassEscape() { this.getValue() in ["d", "D", "s", "S", "w", "W", "h", "H"] } /** Gets the name of the character class; for example, `w` for `\w`. */ // override string getValue() { result = value } diff --git a/ql/test/library-tests/regexp/parse.expected b/ql/test/library-tests/regexp/parse.expected index 4485a0f0f45..97ca1d182f1 100644 --- a/ql/test/library-tests/regexp/parse.expected +++ b/ql/test/library-tests/regexp/parse.expected @@ -216,7 +216,7 @@ regexp.rb: # 33| [RegExpCharacterClassEscape] \d -# 34| [RegExpConstant, RegExpEscape] \h +# 34| [RegExpCharacterClassEscape] \h # 37| [RegExpConstant, RegExpNormalChar] f @@ -291,8 +291,8 @@ regexp.rb: #-----| 1 -> [RegExpCharacterClassEscape] \D # 34| [RegExpSequence] \h\H -#-----| 0 -> [RegExpConstant, RegExpEscape] \h -#-----| 1 -> [RegExpConstant, RegExpEscape] \H +#-----| 0 -> [RegExpCharacterClassEscape] \h +#-----| 1 -> [RegExpCharacterClassEscape] \H # 37| [RegExpSequence] (foo)*bar #-----| 0 -> [RegExpStar] (foo)* @@ -388,7 +388,7 @@ regexp.rb: # 33| [RegExpCharacterClassEscape] \D -# 34| [RegExpConstant, RegExpEscape] \H +# 34| [RegExpCharacterClassEscape] \H # 37| [RegExpConstant, RegExpNormalChar] o