Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-35262

Warnings plugin - regex fails to detect pattern whereas it is correctly detected when declaring the regex in System Configuration page

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • warnings-plugin
    • warnings-plugin 4.52
      Jenkins 1.648

      Hello,

      I have an issue with a regex that does not trigger any warning when set as a console output parser in a job, but seems to be correctly formatted and working in the System Configuration page

      Here are all the details of my sample:
      I created the following sample regex in the System Configuration page:

      (start(?:(?!start)[\s\S])*?end   step: runtimedata.*)
      

      With the following Groovy script:

      import hudson.plugins.warnings.parser.Warning
      import hudson.plugins.analysis.util.model.Priority
      String type = "TEST"
      String category = "runtimedata"
      String errors = matcher.group(1)
      return new Warning("", 0, type, category, errors, Priority.HIGH);
      

      It is supposed to retrieve the lines in red in the following sample:
      start step: at 06/01/2016-12:05:42
      end step: jsruler at 06/01/2016-12:05:42
      start step: at 06/01/2016-12:05:42
      some details here
      on several lines
      end step: runtimedata at 06/01/2016-12:05:42

      start step: at 06/01/2016-12:05:42
      end step: dummynls at 06/01/2016-12:05:42

      This works correctly when I create the regex and put the exact same sample text in the "Example Log Message" field:

      One warning found
      file name: 
      line number: 0
      priority: High Priority
      category:  headerruler
      type: TEST
      message: start step: runtimed[...]data   at 06/01/2016-12:05:42
      

      FYI, I've also tested the regex in several online tools and it works.

      However, when I run a job with the exact same trace in the console output and set the corresponding regex to parse it, no warning is found.
      Please note that this behavior happens only with regex with the pattern (??!someString)

      I looked for answers in forums and such but I haven't been able find anyone else encountering this issue. Since I feel like it is specific to some regex patterns, it might be that nobody else tried this...

      I hope you can find the explanation and correct this, it is quite a pain for me to work around this! Feel free to request any additional information I might have forgotten.

      Best Regards,
      Tyoneb

            drulli Ulli Hafner
            tyoneb BenoƮt CHOMEL
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: