I need to get strings between first pipe to third pipe.
Eg given
DOWN | Origin - test-pd-2 | Pool - test-pd | TCP timeout occurred
match:
Origin - test-pd-2 | Pool - test-pd
I tried this, but it didn't work:
.*\\|(.*)\|
I need to get strings between first pipe to third pipe.
Eg given
DOWN | Origin - test-pd-2 | Pool - test-pd | TCP timeout occurred
match:
Origin - test-pd-2 | Pool - test-pd
I tried this, but it didn't work:
.*\\|(.*)\|
Using a capture group and a negated character class, you might also use
^[^|]*\| ([^|]+\|[^|]*[^\s|])
^.+\|(.+\|{1}.+)\|.+$
Note that backslashes might need to be escaped depending on the language you are using.
After a pipe |, match non-pipes, pipe, non-pipes:
(?<=\| )[^|]+\|[^|]+[^| ]
See live demo.
The entire match is your target