这是我的示例字符串。
[echo] SampleProject 解决方案当前的代码覆盖率为 85%。
我想要的输出应该是。
SampleProject 解决方案目前的代码覆盖率为 85%。
顺便说一句,我之所以这么做是因为我正在使用 Jenkins 来查看 CI 中的日志。
有什么帮助吗?谢谢..
最佳答案
您可以尝试使用 BUILD_LOG_REGEX
token 中的 substText
参数来替换与您的 regex
匹配的文本
New optional arg: ${BUILD_LOG_REGEX, regex, linesBefore, linesAfter, maxMatches, showTruncatedLines, substText} which allows substituting text for the matched regex. This is particularly useful when the text contains references to capture groups (i.e. $1, $2, etc.)
关于jenkins - 从 BUILD_LOG_REGEX 提取的行中删除 "[string]",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12417832/