Hi - I'm trying to create a grok pattern to match a field that contains one or more words and assign a field name to it. When the field contains multiple words, it is wrapped in quotes:
eg. FieldValue or "Field Value" are potential matches.
I've tried 2 approaches:
("(?<FieldName>[^"]+)")|(?<FieldName>\S+)
(?<FieldName>((?:")([^"]+)(?:"))|(\S+))
The first pattern works fine if there is a quoted string (multiple words) but returns NULL if the string to be matched is a single word (I'm assuming because the first pattern in the boolean regex expression wasn't matched?)
The second pattern matches on both quoted strings and single words but includes the quotes in the match, which I don't want.
Another option would be to just remove the quotes using another filter after the grok filter has finished executing but I would prefer to do it in one go if possible.
Any advice is welcome.
Thanks,
Ben.