From 63a0659aa43be8b3e3e86d6e3fe45d2662b1f1ce Mon Sep 17 00:00:00 2001 From: Patrick Jahns Date: Fri, 20 Jan 2017 10:52:17 +0100 Subject: [PATCH] change regex to global regex --- remote/bitbucket/convert.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/remote/bitbucket/convert.go b/remote/bitbucket/convert.go index dc4e0437e..bc6d9171e 100644 --- a/remote/bitbucket/convert.go +++ b/remote/bitbucket/convert.go @@ -193,10 +193,12 @@ func convertPushHook(hook *internal.PushHook, change *internal.Change) *model.Bu return build } +// regex for git author fields ("name ") +var reGitMail = regexp.MustCompile("<(.*)>") + // extracts the email from a git commit author string func extractEmail(gitauthor string) (author string) { - re := regexp.MustCompile("<(.*)>") - matches := re.FindAllStringSubmatch(gitauthor,-1) + matches := reGitMail.FindAllStringSubmatch(gitauthor,-1) if len(matches) == 1 { author = matches[0][1] }