There are several solutions to this problem in the thread starting at Humanized lists of numbers including an amazing regex.
In reply to Re: my head is reeling...
by BrowserUk
in thread Number lists to number ranges (was: my head is reeling...)
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |