Skip to content

Commit 3ec038e

Browse files
Napalyserik-krogh
authored andcommitted
JS: Added predicate to check if v flag is used on regular expression
1 parent 4097aa9 commit 3ec038e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

javascript/ql/lib/semmle/javascript/Expr.qll

+3
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,9 @@ class RegExpLiteral extends @regexp_literal, Literal, RegExpParent {
481481
/** Holds if this regular expression has an `s` flag. */
482482
predicate isDotAll() { RegExp::isDotAll(this.getFlags()) }
483483

484+
/** Holds if this regular expression has an `v` flag. */
485+
predicate isUnicodeSets() { RegExp::isUnicodeSets(this.getFlags()) }
486+
484487
override string getAPrimaryQlClass() { result = "RegExpLiteral" }
485488
}
486489

javascript/ql/lib/semmle/javascript/Regexp.qll

+4
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,10 @@ module RegExp {
11621162
bindingset[flags]
11631163
predicate isDotAll(string flags) { flags.matches("%s%") }
11641164

1165+
/** Holds if `flags` includes the `v` flag. */
1166+
bindingset[flags]
1167+
predicate isUnicodeSets(string flags) { flags.matches("%v%") }
1168+
11651169
/** Holds if `flags` includes the `m` flag or is the unknown flag `?`. */
11661170
bindingset[flags]
11671171
predicate maybeMultiline(string flags) { flags = unknownFlag() or isMultiline(flags) }

0 commit comments

Comments
 (0)