I have a jenkins pipeline in which I've always been searching for a string in case I need to update my build to failure.
findText regexp: 'ERROR', alsoCheckConsoleOutput: true, unstableIfFound: true
https://www.jenkins.io/doc/pipeline/steps/text-finder/
I now need for example to make an exception to allow certain cases of ERROR to be handled differently.
I was looking at this question Regular expression to match a line that doesn't contain a word and this question Regex with exception of particular words but I still could not make it work.
I really suck at regex and trying to play with the different websites I'm struggling a bit with the negatives lookup parts.
Basically I want to ensure that
This is an ERROR bla bla bla
Is an error caught by my regex
But I need to have this as not an error because XYZ shows up before
This XYZ is not an ERROR bla bla bla because of the prefix
I was trying something like this but not really close. (ERROR)+?:(XYZ) Basically ERROR can appear more than once in my output lines but XYZ should never be found. If it helps XYZ will always show up before the ERROR
Any idea?