The Jenkins email-ext plugin supports a ${LOG_REGEX}
'token'. It's documented like this:
${LOG_REGEX}
Uses a regular expression to find a single log entry and generates a new output using the capture groups from it. This is partially based on the description-setter plugin (https://github.com/jenkinsci/description-setter-plugin).
(That's part of the documentation that's shown when I click on the "?" (question mark) associated with the Content Token Reference in the Editable Email Notification section of the Jenkins project configuration page.)
When I use this token, how do I specify the regular expression and the output? I guess it probably takes a pair of parameters, but, if so, what are their names?
I determined through trial and error that the parameter names are regex
and replacement
.
For example, if your job console contains
Started by upstream project "my-project" build number 12345
then the token
${LOG_REGEX, regex="^Started by upstream project \"(.+)\" build number ([0-9]+)", replacement="\\1 #\\2"}
will be replaced by
my-project #12345
Keep in mind that, in parameter values, \
and "
must be escaped with a \
.