I am implementing the formula bar in which there can be any operation with two values like:
SUB ( DIV ( ADD (2,5), 4.5 ), AVG (3,4) )
So here I need to first call ADD
operation as its most inner operation, then DIV
it by some fraction, then calculate the AVG
and in last SUB
both the values, so there can be any formula user can put on formula bar.
I am trying to write recursive function for that but before that I need to parse it properly. I could not figure out how to write regex for this kind of pattern..
Any ideas please?