Grok for values with and without '%' eg: 10, 10%


(grvr) #1

Hi,

I have tried the following but it did not work:
"dedupSavings" => "(?m)%{NUMBER:dedup_savings:float}[^%]"

For instance, (.*[^%]) -> regex outputs 10 for 10 or 10%. But above one is not. It works fine for data with dedupSavings=10% but not for dedupSavings=10.
I might be missing something here, any help is appreciated.


(Magnus Bäck) #2

[^%] means "any character except %" which doesn't seem like what you're looking for. You should probably use %? ("zero or one occurrences of %") instead.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.