I want to divide a string by spaces, but only if the spaces are not within square brackets. For example:
"What a [nice sunny] day"
After dividing, it should look like this:
[What, a, [nice sunny], day]
I tried to find the solution on my own, but I'm afraid I'm not enough familiar with RegExp in javascript.