We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 036d749 commit 15b5658Copy full SHA for 15b5658
1 file changed
ql/src/codeql_ql/performance/InefficientStringComparisonQuery.qll
@@ -45,10 +45,10 @@ class RegexpMatchPredicate extends BuiltinPredicate {
45
predicate canUseMatchInsteadOfRegexpMatch(Call c, string matchesStr) {
46
c.getTarget() instanceof RegexpMatchPredicate and
47
exists(string raw | raw = c.getArgument(0).(String).getValue() |
48
- matchesStr = "%" + raw.regexpCapture("^\\.\\*(\\w+)$", _)
+ matchesStr = "%" + raw.regexpCapture("^\\.\\*([a-zA-Z\\d\\s-]+)$", _)
49
or
50
- matchesStr = raw.regexpCapture("^(\\w+)\\.\\*$", _) + "%"
+ matchesStr = raw.regexpCapture("^([a-zA-Z\\d\\s-]+)\\.\\*$", _) + "%"
51
52
- matchesStr = "%" + raw.regexpCapture("^\\.\\*(\\w+)\\.\\*$", _) + "%"
+ matchesStr = "%" + raw.regexpCapture("^\\.\\*([a-zA-Z\\d\\s-]+)\\.\\*$", _) + "%"
53
)
54
}
0 commit comments