I need to parse a string, such as /a/b/c/d=uno/c=duo.html
into three groups, such as
- /a/b/c/
- d=uno/
- c=duo.html
The parsing rules are:
- The first group is everything until "d=" or the whole string if "d=" is not a part of the string.
- The second group is everything until "c=" or the rest of the string following the first group if "c=" is not a part of the string.
- The third group matches the rest of the string following the second group.
My problem with the following regex (?.+/)?(?d=([^/]+)/)?(?c=(?.*)) is that I don't know how to stop the group when it encounters "d=".
Any help will be appreciated.
Thanks.