Filename pattern matching: is it case sensitive?

In the Narrow the Focus page (e.g., 9.2’s at Narrowing the Focus | SonarQube Docs) is the pattern matching for filenames case-sensitive? The page doesn’t seem to say one way or the other. For instance, the example table shows:

In this example, does org/sonar.api/ match, or not?

This should be added to the page.

Also, does the filename pattern allow for the same kind of regex-combining that one can use for pattern-based rules such as S100? IOW, could I use something like **/*(| to match both and


I’m fairly certain that it’s case sensitive. org/sonar.api/ would match (although the real question is whether org/sonar.api/ would match, and I believe it would not).

For the second question, different patterns are valid in different places and for simple “find the file” patterns, it’s generally just what I call Ant patterns: ** for 0-n directories and * for 0-n chars.


I suspect you’re right about case. It’s just that we are in a Windows server where case-insensitivity is basically baked into the system, so if SQ uses Windows utilities for filename searches it might end up being case-insensitive. So it’d be good to have this in the docs, i.e., whether it’s case-sensitive, case-insensitive, or OS-dependent.

For the second part, I determined empirically that the “ignore on multiple criteria” seems to apply in an OR fashion. If you put two sets of criteria in, the rule is not applied if either set matches, i.e., it doesn’t have to match both.

In our case, we have something like: don’t apply rule java:S1234 to any file bar*.java that’s either part of a directory called foo or is underneath the top-level directory foobar. So we have one pattern /foo/ and another pattern foobar/*/bar*.java and this seems to work.

1 Like