I want to split the string with commas, but not when they are inside the brackets.
For instance:
"[1, '15', [false]], [[], 'sup']"
would be divided into
[ "[1, '15', [false]]", "[[], 'sup']" ]
I tried /\,(?=(.*\[.*\])*.*\]{1})/
for my regular expression, my logic is commas that are not followed by an even number '[]' with any symbols between them and after him, followed by one ']'.
source share