I want to write a regex that match a list of numeric values, given in a comma-separated list, ranges allowed. Empty is not allowed.
Something like: 1-10,20-56,8,7
So far I have (([0-9]+)|([0-9]+-[0-9]+),)*[0-9]+. This does most of the job, except it misses the case of one range only (eg: 1-10 would not validate).
The checking for each range can be omitted (eg: 20-10 can be allowed as a valid range).
Any help would be appreciated.