diff --git a/version.go b/version.go index e87df69..f2447dd 100644 --- a/version.go +++ b/version.go @@ -19,8 +19,8 @@ var ( // of a version. const ( VersionRegexpRaw string = `v?([0-9]+(\.[0-9]+)*?)` + - `(-([0-9]+[0-9A-Za-z\-~]*(\.[0-9A-Za-z\-~]+)*)|(-?([A-Za-z\-~]+[0-9A-Za-z\-~]*(\.[0-9A-Za-z\-~]+)*)))?` + - `(\+([0-9A-Za-z\-~]+(\.[0-9A-Za-z\-~]+)*))?` + + `(-([0-9]+[0-9A-Za-z\-~_]*(\.[0-9A-Za-z\-~_]+)*)|(-?([A-Za-z\-~_]+[0-9A-Za-z\-~_]*(\.[0-9A-Za-z\-~_]+)*)))?` + + `(\+([0-9A-Za-z\-~_]+(\.[0-9A-Za-z\-~_]+)*))?` + `?` // SemverRegexpRaw requires a separator between version and prerelease diff --git a/version_test.go b/version_test.go index 08cbf01..ff73e93 100644 --- a/version_test.go +++ b/version_test.go @@ -25,6 +25,7 @@ func TestNewVersion(t *testing.T) { {"1.2.0-x.Y.0+metadata", false}, {"1.2.0-x.Y.0+metadata-width-hyphen", false}, {"1.2.3-rc1-with-hyphen", false}, + {"1.2.3-rc2-with_underscore", false}, {"1.2.3.4", false}, {"1.2.0.4-x.Y.0+metadata", false}, {"1.2.0.4-x.Y.0+metadata-width-hyphen", false},