I try to get a regex which returns the match in the first capture group.
The Application where I put the regex in can only use the first capture Group.
Each regex on it's own is working, but i can't combine these two in a way that the output is always in the first capture group
Input 1:
Event: Started Flapping
Regex 1:
^Event: (\S+ Flapping)
Output 1:
Started Flapping
Input 2:
Event: CRIT -> OK
Regex 2:
^Event:\s+\S+\s+\S+\s+(\S+)
Ouput 2:
OK
The Regex i tried
(?:^Event:\s+\S+\s+\S+\s+(?P<service>\S+)$|^Event: (?P<flap>Started Flapping)|((?P=service)|(?P=flap)))