To match either 1, or 2 or 4 elements the ERE shoud be modified as follow:

```
s1="1,2,3,4" ;\
s2="1,2,3" ;\
s3="1" ;\
sP='^[1-9][0-9]{0,},$|^(([1-9][0-9]{0,},){2}){1,2}$' ;\
[[ "${s1}," =~ $sP ]] && printf "\$s1, matches\n" ;\
[[ "${s2}," =~ $sP ]] || printf "\$s2, does not match\n" ;\
[[ "${s3}," =~ $sP ]] && printf "\$s3 matches\n"
```

Your original ERE could be described iteratively:

`[1-9][0-9]{0,},`

matches 1, or 2, or 3, or 432, etc.

`([1-9][0-9]{0,},){1,2}`

matches any single or two consecutive sequence described above: 1, or 3, or 1,2, or 10, or 10,432, etc.

`(([1-9][0-9]{0,},){1,2}){1,2}`

matches any 1 or 2 occurrences of the last sequence 1, or 1,2, or 1,2,3, etc.