I have a string as an input that i need to validate. It is a collection of nummbers, can be one or twenty. If there are more than one they are separated with a ','. Basically: 1 or 1,2,5,345,1233 with no trailing or leading whitespace.
Ive tried:
^\d(,\d|$)?$ and ^[0-9]+(,[0-9]+)+$
^\d+(,?\d?)+$ this one seams to work but i am getting warnigs and it matches on strings where there is a trailing ','.
Any foolproof suggestions, I'm not very good at regex I am in c# .net framework 4.7