If I have this text:
blah1=faa faa2 blah2=fee blah3=fii blah4=foo
how can I have the values of each variable (the one that are before the equal sign) with regex? I’ve tried with this grok:
blah1=(?<blah1>[^=]+) blah2=(?<blah2>[^=]+) blah3=(?<blah3>[^=]+) blah4=(?<blah4>[^\n]+)
but it doesn’t work fine when the text changes to something like this:
blah1=faa faa2 blah2=fee blah3=fii
I’ve tried with something like this:
blah1=(?<blah1>[^=]+) blah2=(?<blah2>[^=]+) blah3=(?<blah3>[^=]+)(| blah4=(?<blah4>[^\n]+))
And works.. BUT… that one doesn’t work wit the previous one (it only matches until the “blah3” part):
blah1=faa faa2 blah2=fee blah3=fii blah4=foo
So.. How should I create the grok in order to work in both cases?