`v` prefix is not part of semver
Closed this issue · 6 comments
'v1.0.0'.match(semverRegex())
returns ['v1.0.0']
but should be ['1.0.0']
.
node-semver
handles the v
fine. I don't really see a good way around this, as if you look at the regex itself, you see that it needs to not match foo1.0.0
, but match v1.0.0
and 1.0.0
. PR welcome if you have a solution for this.
Following spec 2.0.0 I didn't see why a v
prefix should be treated differently than any other prefix. I guess semverRegex.test('foo1.0.0')
should be true
if semverRegex.test('v1.0.0')
returns true
. In both cases .match(semverRegex())
should return ['1.0.0']
.
v
is a common convention for indicating something is a version. You can see it in most git tags on GitHub.
I do agree the correct way would be to return the matched version without the v
prefix, but the prefix is so common we can't ignore versions with it, and foo1.0.0
should definitely not be matched. Happy to consider a solution that satisfies these requirements :)
I have taken another path for my feature I needed this. Haven't any idea myself how this one could be handled just by RegExp.
@jelhan I don't know what you need it for, but you might find find-versions
useful.
semver
package clean() method remove all equal and v
characters on its regexp.