Skip to content

Commit

Permalink
allow underscore in version
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnvdp committed Dec 28, 2021
1 parent b991f91 commit b1c25bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions version.go
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions version_test.go
Expand Up @@ -23,6 +23,7 @@ func TestNewVersion(t *testing.T) {
{"1.2.0-x.Y.0+metadata", false},
{"1.2.0-x.Y.0+metadata-width-hypen", false},
{"1.2.3-rc1-with-hypen", 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-hypen", false},
Expand Down

0 comments on commit b1c25bb

Please sign in to comment.