diff options
Diffstat (limited to 'cmd/git-extract-issue/main.go')
| -rw-r--r-- | cmd/git-extract-issue/main.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/git-extract-issue/main.go b/cmd/git-extract-issue/main.go index 4681d4d..2e9255d 100644 --- a/cmd/git-extract-issue/main.go +++ b/cmd/git-extract-issue/main.go @@ -20,10 +20,11 @@ func main() { // * 123-suffix => #123 // * feature/123 => #123 // * feature/123-suffix => #123 +// * feature/123-2 => #123 // * feature/prefix-123 => prefix-123 // * feature/prefix-123-suffix => prefix-123 func extractIssueNumberFromBranchName(branchName string) string { - pattern := regexp.MustCompile(`\A(?:\w+/)?(\w+-)?(\d+)(?:-\w+)*\z`) + pattern := regexp.MustCompile(`\A(?:\w+/)?([A-Za-z][0-9A-Za-z]*-)?(\d+)(?:-\w+)*\z`) matches := pattern.FindSubmatch([]byte(branchName)) if len(matches) != 3 { return "" |
