0

Given this string

some noise
//some more noise
Cherry {
 something 0
 blah 1000
 something 120
 super { something else }
 super { again }
}
Peach {
 apple 1
 caramel salted
}
Banana {
 yellow 12
 super { very yellow }
 super { delicious }
}
Apple {
 red 12
}

How would I capture each fruit AND within a fruit, if a 'super' line is present, group content of their curly braces .

I'm not far using this :

^\S\w+\s\{([^}]+)\}

But if you look at the picture below, it is currently stopping at the first '}' instead of grouping the content between curly braces of the 'super' lines

enter image description here

I hope that makes sense .

Thank you

Finger twist
  • 3,002
  • 9
  • 37
  • 49

0 Answers0