I have a string something like this.
ars:a:currency (Argentina!: Pesos):
i need to split string using colon, but the colon within the brackets should not be split. i need a regex to split this string.
my output should be like
ars
a
currency (Argentina!: Pesos)**
help is appreciated 🙂
You can do it with a single regex if you’re certain that there won’t be any nested parentheses. In that case you can simply split on a colon only if the next parenthesis is not a closing one: