I found some regex to extract key-value style format
but recent I encounter some format like below
"Key1"=123,"Key2"="abc","key3"={"subkey1"=12,"subkey2"="cd"},"key4"=456
this what I wish to output
match | Key | value |
---|---|---|
match0 | Key1 | 123 |
match1 | Key2 | "abc" |
match2 | key3 | {"subkey1"=12,"subkey2"="cd"} |
match3 | key4 | 456 |
how can I escape the "," inside {}
I tried
"(?<key>\w+)"=(?<value>{?"?[^,]*"?}?)
but the result is like
match | Key | value |
---|---|---|
match0 | Key1 | 123 |
match1 | Key2 | "abc" |
match2 | key3 | {"subkey1"=12 |
match3 | subkey2 | "cd"} |
match4 | key4 | 456 |
is there any help to escape only when "," inside {}?