My data looks like this:
[ REPORT_PROFILE = Some text ] [ TIME_GENERATED = 1579734865 ] [ RECORD_NUMBER = 131757058 ]
My data might also contain [ SOME_KEY = Some value]
.
I'd like to extract:
| Key | Value |
|----------------|------------|
| SOME_KEY | Some value |
| REPORT_PROFILE | Some text |
| TIME_GENERATED | 1579734865 |
| RECORD_NUMBER | 131757058 |
I could do this using multiple regexes e.g.
\[\s+REPORT_PROFILE = (?<REPORT_PROFILE>[^\]]+)\s+\]
\[\s+\TIME_GENERATED = (?<TIME_GENERATED>[^\]]+)\s+\]
But is there a way I can use a single regex to extract an arbitrary number of match groups, dynamically naming them based on a key name in the source text?
I'm using Splunk but it's just PCRE under the hood (not PCRE2, to clarify).