Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
However, the formulas quickly got harder and I don’t know how to get around the following complications:
>I need to test for one of the four simple math operators (+-*/) between each code, but not after the last one.
>There can be any number of codes being added together.
>Enclosed parenthesis are okay (X+Y)/2
>Mismatched parenthesis are not okay.
example-1)(basecomponent+5)-4+5 (correct)
2) (8+6)(-( (not correct)
3) b+D-6+7-(G+7)(correct)
4)FLR01+FLR02+FLR03+FMD0+FMR05+(LS400+LT400)*LC430/(EL41+EL414R)(correct)
5)FLR01+FLR02FMD0+-(wrong)
Posted

1 solution

The hardest part is matching the balanced parentheses. Luckily you may find examples on the web, see, for instance, "Matching Balanced Constructs with .NET Regular Expressions"[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900