drvarovt — 2012-11-07T16:47:54-05:00 — #1
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 — 2012-11-07T20:10:31-05:00 — #2
drvarovt — 2012-11-08T16:56:20-05:00 — #3
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
scallioxtx — 2012-11-08T17:40:03-05:00 — #4
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).