I would like to split these strings:
- /d/{?a}
- /a/b/{c}{?d}
- /a/b/c{?d}
into following list of segments:
- [d, {?a}] (this case is easy, just split using /)
- [a, b, {c}, {?d}]
- [a, b, c, {?d}]
For the other cases, splitting using / will not get the result that I wanted. In which case, the last string element of 2. and 3. will be {c}{?d} and c{?d}.
What is the best approach to achieve all 1,2,3 at the same time?
Thanks.