-1

This regex should find java classes witch no '@Configuration' word and more than one '@Inject' word. In java Matcher it works, but not in checkstyle.

<module name="RegexpMultiline">
    <property name="format" value="(?s)((?!@Configuration).)*@Inject.*@Inject.*"/>
</module>    

In this example result is false, but if u delete @Configuration from target text then result is true - good. Checkstyle always produces true.

example regex test

jdorosz
  • 34
  • 5

1 Answers1

1

RegexpMulitiline check is based on find(), see checks/regexp/MultilineDetector.java#L95.

And indeed your example shows that there is Find result (there is no Match though). You need to accommodate your pattern to return nothing also for Find.

Michal Kordas
  • 10,475
  • 7
  • 58
  • 103