I need two regular expressions to define a section if .. then .. else .. endifand its parts.
From an expression that may be as follows:
Example 1:
5 + 10 * (if (4 + 4.5) > 0 then 20 else 45 endif) + 2
Example 2:
if (20 == 10) then 10 endif
Example 3:
if (20/10 != 2) then (2 * 10) else (3 * 4) endif
Expected Result:
A regular expression that can give me a part if..endifin the expression Ex. from example 1 i have to get if (4 + 4.5) > 0 then 20 else 45 endifseparately
A regular expression that can give me parts if..endif. E.g. from example 1 I should get:
Left comparator: (4 + 4.5)
Operator: >
Right comparator: 0
Then Part: 20
ElsePart: 45(can be null or string.Empty)
Note:
else not required.if..endif may be a single expression or may be part of an expression.then else .- , if,
>, <, ==, !=, >=, <= - #.
webSol