I have a mathematical expression (((a+b)(c+d))+p(q*2+r))/2 I am trying to write a C# code to match the groups as below
- (((a+b)(c+d))+p(q*2+r))
- ((a+b)(c+d))
- (q*2+r))
- (a+b)
- (c+d))
Unfortunately I am not able to find one. Can you please help me from this situation
I have an expression "((.*?))" but this can match as below and it is not matching with my need
- (((a+b)
- (c+d)
- (q*2+r)
NB: Expression can be changed. Looking for a generic regex pattern to parse any expression with BODMAS rule