mirror of
https://github.com/github/codeql.git
synced 2026-04-26 09:15:12 +02:00
update inefficientStringComparison, to avoid underscores
This commit is contained in:
@@ -45,10 +45,10 @@ class RegexpMatchPredicate extends BuiltinPredicate {
|
||||
predicate canUseMatchInsteadOfRegexpMatch(Call c, string matchesStr) {
|
||||
c.getTarget() instanceof RegexpMatchPredicate and
|
||||
exists(string raw | raw = c.getArgument(0).(String).getValue() |
|
||||
matchesStr = "%" + raw.regexpCapture("^\\.\\*(\\w+)$", _)
|
||||
matchesStr = "%" + raw.regexpCapture("^\\.\\*([a-zA-Z\\d\\s-]+)$", _)
|
||||
or
|
||||
matchesStr = raw.regexpCapture("^(\\w+)\\.\\*$", _) + "%"
|
||||
matchesStr = raw.regexpCapture("^([a-zA-Z\\d\\s-]+)\\.\\*$", _) + "%"
|
||||
or
|
||||
matchesStr = "%" + raw.regexpCapture("^\\.\\*(\\w+)\\.\\*$", _) + "%"
|
||||
matchesStr = "%" + raw.regexpCapture("^\\.\\*([a-zA-Z\\d\\s-]+)\\.\\*$", _) + "%"
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user