I want to split a string by colon.
This is an example of input:
str = "one[two:[three::four][five::six]]:seven:eight[nine:ten]"
This is an example of output:
array = ["one[two:[three::four][five::six]]", "seven", "eight[nine:ten]"]
The aim is to understand the regex representing the colon outside parentheses and nested parentheses.
But there are some constraints:
- The template of regex must be like this:
^(.+)<colon_regex>(.*)<colon_regex>(.*)$
- The match must be unique, with three groups.
Can you give me a suggestion?