Regex matches the pattern greedily by default, for example:
1 |
|
The pattern "str.+"
matches the whole "str","b":123,"c":"xyz"
A quick fix is to replace .
with [^"]
, so the pattern looks like "str[^"]+"
.
It matches anything but the double quote, thus appears to be “non-greedy”.