Consider the following:
a;b{c;d;}e{f;}
How can I split this into three groups like so:
Group 1: a;
Group 2: b{c;d;}
Group 3: e{f;}
I'm learning regular expressions and I was wondering if I could include a if-then-else type logic into the expression.
What I have now:
(.*?{.*?})
This creates two groups like so:
Group 1: a;b{c;d;}
Group 2: e{f;}
which is not what I want as a; and b{c;d;} are merged.
Pseudo if-then-else:
- Select all characters until either a semi-colon or open curly bracket.
- If semi-colon then stop and complete group.
- Else if open curly bracket then continue selecting all characters until closing curly bracket.
Thanks.