uses [0-9]+ in a bunch of places to match against segments specifying numbers. I suggest this is a little sloppy, in that it matches against the string "000123", and indeed "000000000". I regard those as malformed.
I don't know if this regular expression needs to be super permissive, for backwards-compatibility reasons or whatnot. If this regular expression is meant to be rigorous in what it accepts, I'd suggest switching to something like 0|(?:[1-9][0-9]*) instead.
The current official version-parsing regular expression in the "version-specifiers" document:
https://github.com/pypa/packaging.python.org/blob/main/source/specifications/version-specifiers.rst
uses
[0-9]+
in a bunch of places to match against segments specifying numbers. I suggest this is a little sloppy, in that it matches against the string"000123"
, and indeed"000000000"
. I regard those as malformed.I don't know if this regular expression needs to be super permissive, for backwards-compatibility reasons or whatnot. If this regular expression is meant to be rigorous in what it accepts, I'd suggest switching to something like
0|(?:[1-9][0-9]*)
instead.