failed to parse build number with zero prefix
waruqi opened this issue · comments
When I parse the string and numeric build number, it works normally, but if there is a 0 prefix in the build number, the parsing fails
Is this a specification requirement for the semantic version? Or is it a bug?
^(?P0|[1-9]\d*).(?P0|[1-9]\d*).(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-])(?:.(?:0|[1-9]\d|\d*[a-zA-Z-][0-9a-zA-Z-]))))?(?:+(?P[0-9a-zA-Z-]+(?:.[0-9a-zA-Z-]+)*))?$
I saw the specification, build metadata can contain zero prefix.
1.0.1+HEAD.1234
It works, build: {HEAD, 1234}
1.0.1+HEAD.01234
It does not work, parse 01234
failed
Lines 68 to 70 in a1af47b
there is an online checker. https://jubianchi.github.io/semver-check/#/1.0.1%2BHEAD.001/1.0.1%2BHEAD.001
The zero prefix constraint may only be valid for prerelease.
Thanks mate 👍