Need a regular expression to validate number with comma separator. 1,5,10,55 is valid but 1,,,,10 is not valid.
This should do it:
^d+(,d+)*$
The regex is rather simple: d+ is the first number, followed by optional commas and more numbers.
d+
You may want to throw in s* where you see fit, or remove all spaces before validation.
s*
[+-]?d+
[+-]?d+(?:.d+)?
1.4m articles
1.4m replys
5 comments
57.0k users