I'm wanting to match all values contained within [] brackets using regex in javascript.
I have the following string: [parent][0][child]
Attempting to use the regex value: \[[^]]*\]
Entering both values into the Rexex Tester matches everything successfully, however when I actually implement it, match only returns one array key value.
JS Code:
var string = '[parent][0][child]';
regex = /\[[^]]*\]/;
match = string.match(regex); //Returns just [0]?
I'm wanting match to return an array with all the matching values [parent, 0, child]