CodeQL library for Java/Kotlin
codeql/java-all 4.2.1-dev (changelog, source)
Search

Primitive predicate string::matches

Holds when the receiver matches the pattern. Patterns are matched by case sensitive string matching, and there are two wildcards: _ matches a single character, and % matches any sequence of characters. To match the actual characters _ or % in the pattern, they must be escaped using backslashes. For example, "anythingstring%".matches("%string\\%") holds. To match a literal backslash in front of _ or %, you must escape the backslash. Backslashes that are not part of an escape sequence are matched as literals.

predicate matches(string pattern)