Yes, if your program is meant to deal with an arbitrary number of nested [ ] bracket pairs, then the parsing code will have to be much more complex.
It should not merely check that numbers of [ and ] are equal, but that each [ is correctly paired with a corresponding ] in a valid position in the parsed string. This task is not trivial.