Retrieving doubles from string - simple problem The problem is not very complicated (I mean it is easy to solve it), but the question is how to make it in the easiest way (Java)

Input String: 

String inputString = "[value=20][param=304.2][indicator=1500]";


Expected output: array of doubles : [20.0][304.2][1500.0]

Sample solution:

String[] chunks = inputString.split("=");
String valueStr = chunks[1].substring(0, chunks[1].indexOf(']'));
String paramStr = chunks[2].substring(0, chunks[2].indexOf(']'));
String indicatorStr = chunks[3].substring(0, chunks[3].indexOf(']'));
// parsing by Double.parseDouble forming an array and returning it as a result.


What other (smarter) way would you propose using Java?
Don't know if using regex is overkill, but it does open up for a fairly concise and (in my opinion) readable solution.

public class ArgumentParser {
    public static final Pattern KEY_VALUE_PATTERN = Pattern.compile("\\[([a-zA-Z]+)=(-?\\d+\\.?\\d*)\\]");

    public Map&lt;String, Double&gt; parse(String str) {
        Map&lt;String, Double&gt; values = new HashMap&lt;&gt;();

        Matcher matcher = KEY_VALUE_PATTERN.matcher(str);
        while (matcher.find()) {
            String key = matcher.group(1);
            Double value = Double.parseDouble(matcher.group(2));
            values.put(key, value);
        }

        return values;
    }
}


Edit: The question did ask for an array of doubles to be returned, but that should be trivial to obtain once the parsing is done. Alternatively the parse-method could be modified to only extract the values.