Regular expressions are text matching tools: they do not evaluate strings , and they are very poor at syntactical analysis.
Basically, you can't do it with a regex - or if you can it'll be so silly that you can't maintain or probably even properly test it.
Instead, look at something like this:
The expression evaluator revisited (Eval function in 100% managed .NET)[
^] - which is designed to do that.