lets say I\'ve written a function to evaluate a simple mathematical operation, and I have some user input in a string such as:
\"1 + [2 + [3+4]]\"
How can I parse these squa
I think regex is not a good choice to achieve this functionality
You should convert user expression to postfix or prefix notation and then build an expression tree from them.
This is a standard approach in CS (language does not really matter here) to solve this issue in a clean way