Question: Is there a simpler way, other than String matching, to parse the below string? :

```
com.atlassian.greenhopper.service.sprint.Sprint@719c9e23
    [name=Sprint 1,
     closed=true,
     startDate=2013-04-10T17:58:49.228-07:00,
     endDate=2013-04-24T17:58:49.228-07:00,
     completeDate=2013-04-16T14:42:09.504-07:00,id=10]

```

I am interested in getting the `name`,`closed` and other such values.

(This string is an element of a JSONArray, type `org.codehaus.jettison.json.JSONArray`, that I'm getting from JIRA.)

Answer: 
Where do you get this String from? This output does look very much like a `toString()` implementation. Do you have a reference to this JSONArray object? If so:

The [API](http://jettison.codehaus.org/apidocs/org/codehaus/jettison/json/JSONArray.html) says that the object provides methods such as `getString(int index)`.

Therefore `sprintObject.getString(0)` should return `Sprint 1`
I suppose you can use a regular expression to match occurrences between '=' and ',', assuming you know properties name, closed etc are always there in that order and that they do not include '=', ',' and ']' in their values.

```
Pattern p = Pattern.compile("=.*?[,\\]]");
List<String> matches = new ArrayList<String>();
Matcher matcher = p.matcher(value);
while(matcher.find()) {
    matches.add(matcher.group(0));
}

```

com.atlassian.greenhopper.service.sprint.Sprint@719c9e23[name=Sprint 1,closed=true,startDate=2013-04-10T17:58:49.228-07:00,endDate=2013-04-24T17:58:49.228-07:00,completeDate=2013-04-16T14:42:09.504-07:00,id=10]

Based on your sample matches will now contain the following strings:

* name=Sprint 1,
* closed=true,
* startDate=2013-04-10T17:58:49.228-07:00,
* endDate=2013-04-24T17:58:49.228-07:00,
* completeDate=2013-04-16T14:42:09.504-07:00,
* id=10]

You can take it from here I guess.

Edit: Regex being a good approach or not, this data format looks a lot like a return value from something like

```
public String toString() {
    return super.toString() + ... ;
}

```

Also, on second thought, if there really isn't another option than to parse this format, I would match explicitly for the properties, e.g. use regex "name=.\*?," for name