I'm trying to validate an excel formula style, with the following regex:

```
=SUM\(((?:\w+\d+)(?::\w+\d+)?)((?:,\w+\d+)(?::\w+\d+)?)*\)

```

On this source:

should pass

```
=SUM(A1,A11:A212,A12:A56,A342:A12,A3)
=SUM(A11:A12,A12:a12,A34:A3)
=SUM(A1,A2,A3)
=SUM(A1)

```

should fail

```
=SUM(A11:A212:A2,A12:A56,A4,A342:A12)

```

And I have the validation part working, but I can't figure out how to group each comma sperated values. They should be:

How I want them to be grouped:

```
=SUM(A1,A11:A12,A12:A56,A3)     // Groups: $1 = A1 $2 = A11:A12 $3 = A12:A56 $4 = A3
=SUM(A11:A12,A10:A12,A34:A3)    // Groups: $1 = A11:A12 $2 = A10:A12 $3 = A34:A3
=SUM(A1,A2,A3)                  //Groups: $1 = A1 $2 = A2 $3 = A3
=SUM(A1)                        //Groups: $1 = A1

```

How they are currently grouped:

```
=SUM(A1,A11:A12,A12:A56,A3)     // Groups: $1 = A1 $2 = A3
=SUM(A11:A12,A10:A12,A34:A3)    // Groups: $1 = A11:A12 $2 = A34:A3
=SUM(A1,A2,A3)                  //Groups: $1 = A1 $2 = A3
=SUM(A1)                        //Groups: $1 = A1

```

Notice, its grouping the first and last. I've pretty new with REGEX so if I'm doing something awful here, please point me in the right direction. Thank you!