Build failure conditions with Regex

I want to create a new regex condition so that the build will fail if the number of occurrences of the word "Warning:" exist in the build log more than a certain number (say 1000, it will reduce over time).

I cannot for the life of me get a regex to work, the most recent I have tried is this one that I believe should work:


or a modified version to enable single line matching

1 comment
Comment actions Permalink

Hi Craig

String matching is performed separatelly for each log message, not for the whole log. So regular expressions do not allow to count common mumber of string instances.

As alternate solution you can analise your project by IDEA or ReSharper inspections, and use Fail build on metric change option.



Please sign in to leave a comment.