I need to write a regular expression for taking input like this
23,456,22,1,32767
i.e.
- No commas allowed at the start or end.
- Spaces may come before and/or start of comma for e.g. 23, 45,56 ,67 etc.
- Ranges of each number should be 0-32767.
Currently I am using regular expression like this [0-9]+(,[0-9]+)*
.
This allows for numbers separated by commas only ( not allowing spaces at all), and it does not check for the range of number.