Merge pull request #18794 from erik-krogh/v-flag

JS: Add support for the regex V flag
This commit is contained in:
Erik Krogh Kristensen
2025-02-17 13:56:48 +01:00
committed by GitHub
8 changed files with 20 additions and 3 deletions

View File

@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* Added support for regular expressions using the `v` flag.

View File

@@ -481,6 +481,9 @@ class RegExpLiteral extends @regexp_literal, Literal, RegExpParent {
/** Holds if this regular expression has an `s` flag. */
predicate isDotAll() { RegExp::isDotAll(this.getFlags()) }
/** Holds if this regular expression has an `v` flag. */
predicate isUnicodeSets() { RegExp::isUnicodeSets(this.getFlags()) }
override string getAPrimaryQlClass() { result = "RegExpLiteral" }
}

View File

@@ -1162,6 +1162,10 @@ module RegExp {
bindingset[flags]
predicate isDotAll(string flags) { flags.matches("%s%") }
/** Holds if `flags` includes the `v` flag. */
bindingset[flags]
predicate isUnicodeSets(string flags) { flags.matches("%v%") }
/** Holds if `flags` includes the `m` flag or is the unknown flag `?`. */
bindingset[flags]
predicate maybeMultiline(string flags) { flags = unknownFlag() or isMultiline(flags) }