[GH-ISSUE #279] Complete RegExp to verify version numbers #1934

Closed
opened 2026-04-20 09:45:00 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @rugk on GitHub (Nov 3, 2015).
Original GitHub issue: https://github.com/semver/semver/issues/279

Can we possibly have a full regular expression which can be used to formally verify version numbers according to the spec?
Possibly publish them at https://regex101.com/, because there you can later change (and versionize 😉) it.

This would also allow RegExp pros to just look at this RegExp and get the main ideas how to use semantic verison numbers.

Originally created by @rugk on GitHub (Nov 3, 2015). Original GitHub issue: https://github.com/semver/semver/issues/279 Can we possibly have a full regular expression which can be used to formally verify version numbers according to the spec? Possibly publish them at https://regex101.com/, because there you can later change (and versionize :wink:) it. This would also allow RegExp pros to just look at this RegExp and get the main ideas how to use semantic verison numbers.
Author
Owner

@rugk commented on GitHub (Nov 3, 2015):

This would also prevent such questions: https://github.com/mojombo/semver/issues/271
Because you can easily check it by yourself. 😃

<!-- gh-comment-id:153385234 --> @rugk commented on GitHub (Nov 3, 2015): This would also prevent such questions: https://github.com/mojombo/semver/issues/271 Because you can easily check it by yourself. :smiley:
Author
Owner

@DavidFichtmueller commented on GitHub (Nov 3, 2015):

Take a look at #232 or https://github.com/mojombo/semver/issues/266#issuecomment-135765386 (this one is better). I hope this helps.
I think this should be part of the specification as well.

<!-- gh-comment-id:153387572 --> @DavidFichtmueller commented on GitHub (Nov 3, 2015): Take a look at #232 or https://github.com/mojombo/semver/issues/266#issuecomment-135765386 (this one is better). I hope this helps. I think this should be part of the specification as well.
Author
Owner

@rugk commented on GitHub (Nov 3, 2015):

I also saw https://github.com/mojombo/semver/issues/32 and https://github.com/mojombo/semver.org/issues/59 which have some ideas there.

So I still leave this issue open for adding this to the spec and which would allow keeping the RegExp updated as I found many outdated RegExp in the issues you and I linked to.

<!-- gh-comment-id:153424554 --> @rugk commented on GitHub (Nov 3, 2015): I also saw https://github.com/mojombo/semver/issues/32 and https://github.com/mojombo/semver.org/issues/59 which have some ideas there. So I still leave this issue open for adding this to the spec and which would allow keeping the RegExp updated as I found many outdated RegExp in the issues you and I linked to.
Author
Owner

@FichteFoll commented on GitHub (Nov 3, 2015):

Note that because of ambiguity in #181 we are currently unable to construct an exact regular expression, although the unpublished BNF suggests a solution.

<!-- gh-comment-id:153430139 --> @FichteFoll commented on GitHub (Nov 3, 2015): ~~Note that because of ambiguity in #181 we are currently unable to construct an exact regular expression, although the _unpublished_ BNF suggests a solution.~~
Author
Owner

@rugk commented on GitHub (Nov 3, 2015):

As far as I understand here is a RegExp which respects the loading zeros convention.
So do you mean this with BNF or what else?

Edit: Okay, found out what the BNF is. So actually you want to automatically create a RegExp out of the BNF, whcih is currently not seem possible, because the leading zeros part is missing in the BNF:

<!-- gh-comment-id:153431883 --> @rugk commented on GitHub (Nov 3, 2015): As far as I understand [here](https://github.com/mojombo/semver.org/issues/59#issuecomment-57841224) is a RegExp which respects the loading zeros convention. ~~So do you mean this with BNF or what else?~~ **Edit:** Okay, found out what the BNF is. So actually you want to automatically create a RegExp out of the BNF, whcih is currently not seem possible, because the leading zeros part is missing in the BNF:
Author
Owner

@FichteFoll commented on GitHub (Nov 3, 2015):

No, in the initial post of #181 it is explained that the spec would be ambiguous whether digits-only identifiers with leading zeros make a valid semantic version. I just came to the conclusion that it's in fact not ambiguous, so you can ignore my comment.

<!-- gh-comment-id:153457608 --> @FichteFoll commented on GitHub (Nov 3, 2015): No, in the initial post of #181 it is explained that the spec would be ambiguous whether digits-only identifiers with leading zeros make a valid semantic version. I just came to the conclusion that it's in fact not ambiguous, so you can ignore my comment.
Author
Owner

@haacked commented on GitHub (Aug 5, 2016):

Closing this in lieu of mojombo/semver.org#59

<!-- gh-comment-id:237890887 --> @haacked commented on GitHub (Aug 5, 2016): Closing this in lieu of mojombo/semver.org#59
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/semver#1934