I want to extract text between these brackets {}. The code looks like this:
s = '{asdf=5;iwantthis123jasd}hhhhh{gggg}'
The desired outcome would look like this:
asdf=5;iwantthis123jasd, gggg
However, when I use this code
import re
s = '{asdf=5;iwantthis123jasd}hhhhh{gggg}'
result = re.search("{(.*)}", s)
print(result.group(1))
The output is the following:
asdf=5;iwantthis123jasd}hhhhh{gggg
So the code catches only first and last bractet. How to do it so it catches the first closing bracket it finds and then do the same for the next one?
Thanks :)