We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0da554c commit 2e78077Copy full SHA for 2e78077
python/ql/src/semmle/python/regex.qll
@@ -12,10 +12,14 @@ private predicate re_module_function(string name, int flags) {
12
name = "subn" and flags = 4
13
}
14
15
+/**
16
+ * Holds if `s` is used as a regex with the `re` module, with the regex-mode `mode` (if known).
17
+ * If regex mode is not known, `mode` will be `"None"`.
18
+ */
19
predicate used_as_regex(Expr s, string mode) {
20
(s instanceof Bytes or s instanceof Unicode)
21
and
- exists(ModuleValue re | re.getName() = "re" |
22
+ exists(ModuleValue re | re = Module::named("re") |
23
/* Call to re.xxx(regex, ... [mode]) */
24
exists(CallNode call, string name |
25
call.getArg(0).refersTo(_, _, s.getAFlowNode()) and
0 commit comments