I have a string that I expect to be formatted like so:
{List:[Names:a,b,c][Ages:1,2,3]}
My query looks like this in javascript:
var str = "{List:[Names:a,b,c][Ages:1,2,3]}";
var result = str.match(/^\{List:\[Names:([a-zA-z,]*)\]\[Ages:([0-9,]*)\]\}$/g);
Note: I recognize that with this regex it would pass with something like "Ages:,,,", but I'm not worried about that at the moment.
I was expecting to get this back:
result[0] = "{List:[Names:a,b,c][Ages:1,2,3]}"
result[1] = "a,b,c"
result[2] = "1,2,3"
But no matter what I seem to do to the regular expression, it refuses to return an array of more than one match, I just get the full string back (because it passes, which is a start):
result = ["{List:[Names:a,b,c][Ages:1,2,3]}"]
I've looked through a bunch of questions on here already, as well as other 'intro' articles, and none of them seem to address something this basic. I'm sure it's something foolish that I've overlooked, but I truly have no idea what it is :(