A range expression may match numbers bigger than the upper bound if the upper bound has leading zeroes and more digits than the lower bound. Furthermore, a range expression may match numbers smaller than the lower bound if it has more leading zeroes.
To Reproduce
^ range '1'-'050' $
This incorrectly matches the string 70.
^ range '05'-'1000' $
This incorrectly matches the string 001.
Expected behavior
Since it is not obvious what the above expression does (should it match the string 04? Should it match 004?) The above should be forbidden. Leading zeroes should only be allowed on the lower bound, unless the lower and upper bound have the same number of digits.
Describe the bug
A
range
expression may match numbers bigger than the upper bound if the upper bound has leading zeroes and more digits than the lower bound. Furthermore, arange
expression may match numbers smaller than the lower bound if it has more leading zeroes.To Reproduce
This incorrectly matches the string
70
.This incorrectly matches the string
001
.Expected behavior
Since it is not obvious what the above expression does (should it match the string
04
? Should it match004
?) The above should be forbidden. Leading zeroes should only be allowed on the lower bound, unless the lower and upper bound have the same number of digits.