I am struggling to come up with a universal regexp that will remove/isolate all leading/trailing garbage from a multi-line string, leaving only the JSON. Without opening up a temporary buffer to re-search-forward/backward for the first and last wavy brackets, how can I programmatically remove everything before the first { and everything after the last }?
CAVEAT: Sometimes, there may not necessarily be any leading/trailing garbage, but there often will be.
BEFORE
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. [Donec hendrerit
tempor tellus.]
Donec pretium posuere tellus. Proin quam nisl, tincidunt et,
mattis eget, convallis nec, purus. {Cum sociis natoque [penatibus et] {magnis
dis} parturient montes, {nascetur ridiculus} mus.} Nulla posuere. Donec vitae
dolor."
AFTER
"{Cum sociis natoque [penatibus et] {magnis
dis} parturient montes, {nascetur ridiculus} mus.}"