I'm trying to parse mathematical expressions with nested brackets:
(1 * (2 - 3)) + 4
I want to get every expression in brackets, like this:
(1 * (2 - 3))(2 - 3)
Using this expression: (.*?\))(?=($|[^(]+)) I'm getting this result:
(1 * (2 - 3)
)
And using this expression: \(.*?\) I'm getting this result:
(1 * (2 - 3)
But nothing works correctly. How can I loop an expression inside?