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 May 22, 2023
1 parent 644291d commit a0e780e
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 @@ -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},
Expand Down

0 comments on commit a0e780e

Please sign in to comment.