Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v prefix is not part of semver #7

Closed
jelhan opened this issue Jul 29, 2016 · 6 comments · Fixed by #15
Closed

v prefix is not part of semver #7

jelhan opened this issue Jul 29, 2016 · 6 comments · Fixed by #15

Comments

@jelhan
Copy link
Contributor

jelhan commented Jul 29, 2016

'v1.0.0'.match(semverRegex()) returns ['v1.0.0'] but should be ['1.0.0'].

@sindresorhus
Copy link
Owner

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.

@jelhan
Copy link
Contributor Author

jelhan commented Jul 30, 2016

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'].

@sindresorhus
Copy link
Owner

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 :)

@jelhan
Copy link
Contributor Author

jelhan commented Aug 19, 2016

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.

@sindresorhus
Copy link
Owner

@jelhan I don't know what you need it for, but you might find find-versions useful.

@piranna
Copy link

piranna commented Dec 2, 2016

semver package clean() method remove all equal and v characters on its regexp.

stroncium added a commit to stroncium/semver-regex that referenced this issue Mar 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants