我有以下要求用户可以输入多个值,例如 10,20,30,35-40,45,50-55 //Valid
User can enter multiple values - seprated
e.g. 10,20-30,35-40 //Valid
e.g. 10,20-30,35-40,-1000 //Invalid
我有以下正则表达式
^
(?:
(?:[0-9]?\d|[0-9])(?:-[0-9]?\d|[0-9])?
)
(?:
,(?:[0-9]?\d|[0-9])(?:-[0-9]?\d|[0-9])?
)*
$
I am validating following value
10,20-30,35-40 Valid
01-50, invalid
50 Valid
500 Valid
40-50,50-60,5,50 Valid
40-50,1234-4567 Invalid (Expected: this should be valid)
5-50 Valid
5,80 Valid
8,71 Valid
test and lol Invalid
08,60 Valid
请帮助我编写正确的正则表达式以实现正确的输出。