I am trying to create regex that will parse digits input like: digit1 - digit2 OR digit1 - digit2,digit3 - digit4,digit5 - digit6,digit7 - digit8…
With examples:
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…
ex1: 1,3-5,8-19,25,35,43
ex2: 7,12-15,20,29,30-35,39-43
or may be just digits like 4,8,11,17
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).