Your code is doing exactly what you tell it: split the string using "," as a delimiter:
"[1, 2, 3]" => "[1" , " 2", " 3]"
You could massage the string into shape before using split() - to remove the spaces and the square brackets. However a more direct, regex way to do it is to use a Matcher to scan through the input string:
Pattern pattern = Pattern.compile("(\\d+)\\D+");
ArrayList<String> list = new ArrayList<String>();
Matcher matcher = pattern.matcher(input);
while(matcher.find()) {
list.add(matcher.group(1));
}
// if you really need an array
String[] array = list.toArray(new String[0]);
This pattern (\d+)\D+ matches one or more digits, followed by one or more non-digits, and it captures the digits in a group, which you can access using matcher.group(1). It matches your input quite loosely; you could make it more specific (so that it would reject input in other forms) if you preferred.
substringfirst. thensplit[]?