I am trying to create regex that will parse digits input like: digit1 - digit2 OR digit1 - digit2,digit3 - digit4,digit5 - digit6,digit7 - digit8......
Please note that last char should not be "," and there should not be two or more "-" like 1-5-10!
felgall thank you, this is the real solution!
while I am here, may I ask you what I should change if I add plus any digit before or after... something like...
or may be just digits like 4,8,11,17
That would be
This will for example also accept: 1,2,3,4,5-15,18
Please note that this only checks on syntax, not correctness. i.e., 1-3,5-2,1,9-6 would be accepted just fine, while the range itself is completely weird (and can be rewritten to 1-9).