mirror of
https://github.com/semver/semver.git
synced 2026-07-11 06:53:03 -05:00
[GH-ISSUE #199] How to verify that a string is a valid version? #1000
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @timfriske on GitHub (May 20, 2014).
Original GitHub issue: https://github.com/semver/semver/issues/199
Hi,
I've written the following regular expression to verify that a string is a valid version according to MAJOR.MINOR.PATCH-PREREL, i.e. excluding the build metadata part:
I would appreciate it if this regular expression becomes part of the specification or at least the FAQ.
@damianpowell commented on GitHub (May 20, 2014):
You could fairly trivially validate the build metadata too. It is part of the spec, after all.
I included some line breaks for "readability" - these should obviously be removed if the expression is used in code.
@FichteFoll commented on GitHub (May 20, 2014):
https://github.com/mojombo/semver/issues/192#issuecomment-40935547
@haacked commented on GitHub (Jul 1, 2014):
Looks like this question was answered. If not, feel free to reopen.