需要正则表达式仅包含 jenkins 管道中 email-ext 插件中控制台输出的特定行

Need regex to included only specific lines from console output in email-ext plugin in jenkins pipeline

需要包含来自 jenkins 管道控制台输出的特定行(一些 ID)并使用 email-ext 插件发送。我如何为此编写正则表达式。 例如:

Console ouput
published xyz
[servername] out: Built 123abcwxyabjd
few lines of o/p
[servername2] out: Built ewrewfdsfabcwxyabjd
again some o/p
[servername3] out: Built 1458543abcwxyabjd
published abc
some o/p
[servername2] out: Built dfds123abcwxyabjd
some o/p
[servername] out: Built dsfdsabcwxyabjd

我在 o/p

中需要什么
published xyz
[servername] out: Built 123abcwxyabjd
[servername2] out: Built ewrewfdsfabcwxyabjd
[servername3] out: Built 1458543abcwxyabjd
published abc
[servername2] out: Built dfds123abcwxyabjd
[servername] out: Built dsfdsabcwxyabjd

还有一个问题是阶段是并行的,即 已发布的 xyz 和已发布的 abc 是并行的,并且将输出不按顺序的 ID

对我来说,我可以得到像

这样的所有行
[servername] out: Built 123abcwxyabjd
[servername] out: Built 123abcwxyabjd



$(BUILD_LOG_REGEX, regex=".*(?=.*?Built).*?$

对我来说,我可以得到像

这样的所有行
[servername] out: Built 123abcwxyabjd
[servername] out: Built 123abcwxyabjd

但无法区分哪个是哪个发布阶段。 即使我可以 select 前三个 id,然后发布文本,然后三个 id,然后发布一些文本。可能会有帮助。

尝试

^(.* out: Built|published ).*$

https://regex101.com/r/CuAYph/2右边也有说明