简体   繁体   中英

Jenkins Log Parser rule to exclude text between two strings

I'm using Jenkins log parser plugin to parse the console for errors. I'm trying to create a rule to OK a block of text between two strings without raising any flag.

I know ok /abc.*xyz/ rule works for single line.How do I extend this to a block of text or multiple lines like:
For example:

abc
... ...
... ...
... ...
xyz
Note: "xyz" is the first string that's matched after "abc"

I tried ok /abc(?s)(.*?)xyz/ but was unable to make it work.

Can anyone help me here?

I think this should works:

/abc([\S\s]*)xyz/g

That will give you the data between abc and xyz .

[Regex Demo]

I think you can use it like this:

${BUILD_LOG_REGEX, regex="(?i)abc[\\S\\s]xyz", showTruncatedLines=false}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM