I'm trying to come up with a regular expression that will allow me to parse a colon delimited token, formatted as a key and value pair.
[/foo:bar] // where [key:value]
The tricky part is that a token value can contain another token.
[/foo:[/foo:bar]]
In the above case, I want to match foo as the key and [/foo:bar] as the value. The following expression works:
^\[/([^:]+):(.*)\]+$
However, this does not work when the string has multiple tokens. For example:
[/foo:[/foo:bar]][/foo:bar] // results in foo and [/GetPath:[/GetPath:]]][/foo:bar
I imagine I'm only slightly off, but I cannot, for the life of me, figure out what I'm missing.